chrisryhal
asked on
Datagrid Doubleclick prblem
I have a datagrid that is displaying information based on a ToolID. A doubleclick feature is on the datagrid, to fill a textbox on the form with data from the column "Description". The function is "kinda" working, however, the doublecllick feature is not displaying the correct information. Example table view direct from SQL:
ID ToolID Description
====================
1 10001 MachineShop
2 10001 MachineShop
3 10009 Shipping
4 10009 Shipping
5 25847 Inspection
Now, on the actual Windows Form, it display's like so, because in this case ToolID = 25847
ID ToolID Description
====================
5 25847 Inspection
However, when I doubleclick the row, the value I get is Description = MachineShop.
=================CODE===== ========== ====
Private Sub DocumentDataGrid_DoubleCli ck(ByVal sender As Object, ByVal e As System.EventArgs) Handles DocumentDatagrid.DoubleCli ck
Dim pt As System.Drawing.Point = DocumentDatagrid.PointToCl ient(Curso r.Position )
Dim hti As DataGrid.HitTestInfo = DocumentDatagrid.HitTest(p t)
If hti.Type = DataGrid.HitTestType.RowHe ader Then
txtDescription.Text = CType(DocumentData.Tables( 0).Default View.Item( hti.Row).I tem("Descr iption"), String)
End If
End Sub
ID ToolID Description
====================
1 10001 MachineShop
2 10001 MachineShop
3 10009 Shipping
4 10009 Shipping
5 25847 Inspection
Now, on the actual Windows Form, it display's like so, because in this case ToolID = 25847
ID ToolID Description
====================
5 25847 Inspection
However, when I doubleclick the row, the value I get is Description = MachineShop.
=================CODE=====
Private Sub DocumentDataGrid_DoubleCli
Dim pt As System.Drawing.Point = DocumentDatagrid.PointToCl
Dim hti As DataGrid.HitTestInfo = DocumentDatagrid.HitTest(p
If hti.Type = DataGrid.HitTestType.RowHe
txtDescription.Text = CType(DocumentData.Tables(
End If
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
emoreau: That was a great website to bookmark too. I will give you some points too. I learned a lot from that site.
ASKER