I am looking for some help in fixing a datagrid problem. I am using the following code to capture a double click and open our Order Entry form:
'Add Textbox Double Click Hander
AddHandler dgcsOrderID.TextBox.DoubleClick, New EventHandler(AddressOf TextBoxDoubleClickHandler)
'Opens Order Form with Double Clicked Order ID
Private Sub TextBoxDoubleClickHandler(ByVal sender As Object, ByVal e As EventArgs)
Dim drID As DataRow = objdsOrders.qryLIST_Orders.Rows(dgOrders.CurrentCell.RowNumber)
Dim intOrderID As Integer = drID.Item("OrderID")
If intdblclickcount = 0 Then
intdblclickcount = 1
This works fine when the form is first opened. However, when I sort on any column header, the data sorts, but apparently, the underlying data [objdsOrder.qryLIST_Orders.Rows(dgOrders.CurrentCell.RowNumber)] does not. When I double click the order ID, it opens the original unsorted value of that row, not the display data. For example:
Before I sort the data:
Clicking on row one opens Bob's order - this is fine.
After I sort the data:
Clicking on row one still opens Bob's order - this is not fine.
I need a way to retrieve the sorted data, and points will be awarded to code that accomplishes that. TIA.