在我创建了三个动态 Gridview的表单中,我想对特定 Gridview 的选择执行一些特定的操作,谁能帮我知道哪个 gridview 得到了选择?
问问题
33 次
1 回答
0
DataGridView 上有一个 .GotFocus() 事件,您可以使用该事件将某些内容存储在表单范围(或全局)变量中。(对不起VB...)
Dim LastGirdWithFocus As String = ""
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
MsgBox(LastGirdWithFocus)
End Sub
Private Sub dgv1_GotFocus(sender As Object, e As System.EventArgs) _
Handles dgv1.GotFocus, dgv2.GotFocus
LastGirdWithFocus = sender.name
End Sub
于 2013-06-17T20:19:42.907 回答