Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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!

Posted

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.....

Hamlet
Posted

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.....

Posted
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.
Hamlet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...