I came across an example that looks like this:
Public Sub OnClockTick2(ByVal sender As Object, ByVal e As
EventArgs) Handles MyFirstButton.Click, MySecondButton.Click
Console.WriteLine(';Received a click event of first or second button';)
End Sub
which gives me an idea of what I am trying to do. I have a form with multiple textboxes, and I want to do the same thing for each of those textboxes when text is changed in any of them. My question is, however, how do I determine which textbox was changed? Would it have something to do with ';sender'; ?
thanks!!VB.NET, one event for multiple controls?
sender is an Object.
All Objects have an Equals() method for reference comparison.
Compare sender to MyFirstButton with a simple if..else statement.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment