Home Forums WinForms controls Xceed Grid for WinForms Updating another column of the current row

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13766 |

    Hi,

    I have a grid with 2 columns needs to have synchronized values.

    So for example, if a user changes the value of a cell of column A to 12.50, the value of the cell of column B has to change to 12.50 as well.

    I currently use a gridNumericTextBox as the editor of both columns. To capture changes made by the use, i use the textbox’s OnLostFocus event.

    When LostFocus triggers, my event handler would get the current row and update column B with column A’s value.

    The problem however happens when LostFocus triggers as the user clicks on another row instead of the row that the user was editing.

    My event handler in this case updates the ‘clicked’ row instead of the row that was being edited. This is because the current row is the ‘clicked’ row now.

    I want the edited row to be updated instead of the ‘clicked’ row .. any ideas how i can do this?
    Any help is appreciated … THANKS!!

    ============================

    grdCharges.Columns(0).CellEditor = gTxtChargePerUnit

    Private Sub gTxtChargePerUnit_Event(ByVal sender As System.Object, ByVal ne As System.EventArgs) Handles gTxtChargePerUnit.TextChanged

    Dim currRow As Xceed.Grid.DataRow = CType(grdCharges.SelectedRows(0), Xceed.Grid.DataRow)
    currRow.Cells(1).Value = gTxtChargePerUnit.Text

    End Sub

    Imported from legacy forums. Posted by stktung (had 2616 views)

    User (Old forums)
    Member
    Post count: 23064

    Have you tried using the OnLeave event?

    Imported from legacy forums. Posted by Kareem (had 233 views)

    User (Old forums)
    Member
    Post count: 23064

    Try this:<code>Private Sub cell0_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grdCharges.DataRowTemplate.Cells(0).ValueChanged
    Dim cell As Xceed.Grid.Cell = CType(sender, Xceed.Grid.Cell)
    Dim row As Xceed.Grid.CellRow = cell.ParentRow
    row.Cells(1).Value = cell.Value
    End Sub</code>

    Imported from legacy forums. Posted by Tommy (had 3736 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.