Hello, I am having a problem pulling data from a row Double-clicked in a vb data grid. What I want to do is double-click the row, put the first column's contents in one text box, the second column's contents in a second text box. Unfortunately the row index I am getting back is always -1.
I have tried:
Dim pt = New Point(e.X, e.Y)
Dim hit As DataGrid.HitTestInfo = Me.dgExtract.HitTest(pt)
rowIndex = hit.Row
But in debug mode, when I hover the mouse over rowIndex, it is alway -1.
I have tried this:
Dim rowIndex As Integer
rowIndex = Me.dgExtract.CurrentRowIndex
Me.txt_BatchNumber.Text = Me.dgExtract.Item(rowIndex, 0).ToString
Me.txt_StoreID.Text = Me.dgExtract.Item(rowIndex, 1).ToString
Again, the rowIndex is -1, if I let it go, it errors out on me when it tries to assign the value.
I found the above code in this forum. It seems logical, am I missing something simple ?
lauriemc
I have tried:
Dim pt = New Point(e.X, e.Y)
Dim hit As DataGrid.HitTestInfo = Me.dgExtract.HitTest(pt)
rowIndex = hit.Row
But in debug mode, when I hover the mouse over rowIndex, it is alway -1.
I have tried this:
Dim rowIndex As Integer
rowIndex = Me.dgExtract.CurrentRowIndex
Me.txt_BatchNumber.Text = Me.dgExtract.Item(rowIndex, 0).ToString
Me.txt_StoreID.Text = Me.dgExtract.Item(rowIndex, 1).ToString
Again, the rowIndex is -1, if I let it go, it errors out on me when it tries to assign the value.
I found the above code in this forum. It seems logical, am I missing something simple ?
lauriemc