Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB10

Multiple Event Handling for the Lazy Ones

5.00/5 (1 vote)
25 May 2011CPOL 6.6K  
why not just create a custom handler for all the textboxes? addhandler textbox1.textchanged, addressof textchangedhandler addhandler textbox2.textchanged, addressof textchangedhandler .... 'add additional textbox handlers .... addhandler textbox7.textchanged, addressof...
why not just create a custom handler for all the textboxes?

VB
addhandler textbox1.textchanged, addressof textchangedhandler
addhandler textbox2.textchanged, addressof textchangedhandler
....
'add additional textbox handlers
....
addhandler textbox7.textchanged, addressof textchangedhandler


For the customer handling routine

VB
private sub TextchangedHandler(ByVal sender As System.Object, ByVal e As System.EventArgs)
 '....
 'Do sub code
 '....
end sub

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)