Windows Forms Question

J

John Wright

Is there a way I can capture the event on the form and react to it. I have
some textboxes that I want to capture which textbox is firing the
textchanged event. I can tie all the textboxes to the one event using the
handles keyword and listing all the text boxes, but all I want is the
control that is firing, check if it is a textbox, get the key value and do
some processing. Basically I want a control array. How can I do this?

John Wright
 
H

Herfried K. Wagner [MVP]

John Wright said:
Is there a way I can capture the event on the form and react to it. I
have some textboxes that I want to capture which textbox is firing the
textchanged event. I can tie all the textboxes to the one event using the
handles keyword and listing all the text boxes, but all I want is the
control that is firing, check if it is a textbox, get the key value and do
some processing.

Inside the event handler:

\\\
Dim SourceControl As TextBox = DirectCast(sender, TextBox)
MsgBox(SourceControl.Name)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top