How do I find out which control has focus in .NET Windows Forms?

前端 未结 7 1196
逝去的感伤
逝去的感伤 2020-12-03 21:06

How do I find out which control has focus in Windows Forms?

7条回答
  •  醉梦人生
    2020-12-03 21:18

    You can use this to find by Control Name .

        If DataGridView1.Name = Me.ActiveControl.Name Then
            TextBox1.Visible = True
        Else
            TextBox1.Visible = False
        End If
    

提交回复
热议问题