1

How can I get the ID of the TextBox which is currently focused? If none is focused, it should return a null value.

Note: It should only check text boxes.

Picrofo Software
  • 5,475
  • 3
  • 23
  • 37
omega
  • 40,311
  • 81
  • 251
  • 474

1 Answers1

3
TextBox focusedTxt = Controls.OfType<TextBox>().FirstOrDefault(x => x.Focused);
Dev
  • 367
  • 1
  • 10