Reputation: 43833
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.
Upvotes: 1
Views: 1118
Reputation: 367
TextBox focusedTxt = Controls.OfType<TextBox>().FirstOrDefault(x => x.Focused);
Upvotes: 3