如何提取DataGrid单元格的值
我想把DataGrid选定的单元格的值赋值给一个textbox.text属性,请问如何实现?谢谢!
[此贴子已经被作者于2006-9-19 19:16:33编辑过]
Private Sub dgApt_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgApt.MouseDown
Dim myGrid As DataGrid = CType(sender, DataGrid)
Dim hti As System.Windows.Forms.DataGrid.HitTestInfo
hti = myGrid.HitTest(e.X, e.Y)
If hti.Row = -1 Then Exit Sub
Try
mAptId = CInt(dgApt.Item(hti.Row, 0))
CmbAType.Text = Trim(dgApt.Item(hti.Row, 1))
cmbStation.Text = Trim(dgApt.Item(hti.Row, 2))
Catch ex As Exception
End Try
End Sub
应该利用HITTEST的属性
谢谢各位, ----------雪中送炭-----------