I have 25 textboxes. I have one button that will paste information in a Selected textbox(The one that is focused). Here is the code i had used:
foreach (Control z in this.Controls)
{
if (z is TextBox)
{
((TextBox)(z)).Paste();
}
}
When i use this, all of the textboxes get pasted in. I only need the focused one. I am completely stumped. How do i fix this problem?
How about this?
According to MSDN Control.Focused is true if the control has focus, otherwise false
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.focused.aspx