在表单中我创建了三个动态Gridview ,我想对特定Gridview的选择执行一些特定的操作,任何人都可以帮我知道哪个gridview得到了seletec?
答案 0 :(得分: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