Double Click in Datagrid

prav_roy

Well-known member
Joined
Sep 10, 2005
Messages
70
Location
Mumbai
Programming Experience
1-3
hi,
i have one windows application, in which i have a datagrid, what i want to do is that when i click on any row once that row should be highlighted and if i douuble click on it that particular row details should be opened in new form (which i can carry out using datagrid's double click event, but problem is to fire that event i have to click extreame left of the grid) any sollution's please
Thank you
 
VB.NET:
    Private Sub EmployeeGrid_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmployeeGrid.DoubleClick
        tCurrentEmployee = EmployeeGrid.Columns("Employee").Value
        editEmployee.Text = tCurrentEmployee
        editMachine.Focus()
    End Sub
I'm using ComponentOne datagrids so this line would change:
tCurrentEmployee = EmployeeGrid.Columns("Employee").Value
Still, that code allows a double click anywhere in the grid, you just need to save a field value from that row in some manner. Double click automatically makes that row the active row. I assume you would set a variable to the value of the record's key field and use that to access the record on the other form.
 
Back
Top