jtstanish Posted December 11, 2004 Posted December 11, 2004 I have created an array of label objects and placed them on a form in a VB .NET application. How do I generate .CLICK actions for these objects? Also can I have all of them call the same subroutine on click passing the control itself. In this way I can change the control's properties when it is clicked. Thanks! Quote
Administrators PlausiblyDamp Posted December 11, 2004 Administrators Posted December 11, 2004 You need to look at the AddHandler and RemoveHandler keywords, if you search these forums you should find some examples. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
donnacha Posted December 13, 2004 Posted December 13, 2004 Use something like AddHandler Me.Controls("Button1").Click, AddressOf Button2_Click AddHandler Me.Controls("Button2").Click, AddressOf Button2_Click AddHandler Me.Controls("Button3").Click, AddressOf Button2_Click the rest you should be able to fighre out if you look at the built in help..... Quote Hamlet
jtstanish Posted December 14, 2004 Author Posted December 14, 2004 Thanks ... But I need more detail please What is "AddressOf Button2_Click" The name of a subroutine? Sorry, I'm very new to VB .NET ... Use something like AddHandler Me.Controls("Button1").Click, AddressOf Button2_Click AddHandler Me.Controls("Button2").Click, AddressOf Button2_Click AddHandler Me.Controls("Button3").Click, AddressOf Button2_Click the rest you should be able to fighre out if you look at the built in help..... Quote
Administrators PlausiblyDamp Posted December 15, 2004 Administrators Posted December 15, 2004 Button2_click would be a valid event handler for a button click event, really just a subroutine with a specific method signature. 'should be similar to private sub Button2_click(sender as object, e as Eventargs) 'handle button click here end sub Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
donnacha Posted December 15, 2004 Posted December 15, 2004 We are not here to do the work for you, you must read somestuff yourself, you are asking questions that is given in the VS help or command syntax, please read this info. Quote Hamlet
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.