farshad Posted August 8, 2003 Posted August 8, 2003 (edited) Hi, Do u have an example for me to be able to double click a win datagrid and pick up the values in the cells for that row Thanks Edited August 8, 2003 by farshad Quote Farshad
bfellwock Posted August 8, 2003 Posted August 8, 2003 (edited) Here you go: Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown Dim hitInfo As DataGrid.HitTestInfo = sender.HitTest(e.X, e.Y) 'Here is the code to get one cell If hitInfo.Type = DataGrid.HitTestType.Cell Then MsgBox(sender.Item(hitInfo.Row, hitInfo.Column)) End If 'Here is the code to get the whole row Dim i As Integer If sender.BindingContext(sender.DataSource, sender.DataMember).Count > 0 Then Dim bm As BindingManagerBase = Me.BindingContext(sender.DataSource, sender.DataMember) For i = 0 To CType(bm.Current, DataRowView).Row.ItemArray.Length - 1 MsgBox(CType(IIf(IsDBNull(bm.Current(i)), "(null)", bm.Current(i)), String)) Next End If End Sub Edited August 8, 2003 by bfellwock Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.