Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi,

I create some custom button items in code.

I need to have some code for their Button_Click event and set Button.Checked = Not Button.Checked

So I use this code:

 

AddHandler MyAccount1Button.Click, AddressOf SubAccountButtonItem
AddHandler MyAccount2Button.Click, AddressOf SubAccountButtonItem
...

Private Sub SubAccountButtonItem(ByVal sender As Object, ByVal e As System.EventArgs)

   'How to set every Button clicked to not to clicked?
   'Button.Checked = Not Button.Checked

End Sub

Edited by snarfblam
  • Leaders
Posted

If what you are asking is how to uncheck the button that was clicked, note that the button that was actually clicked is passed as the sender argument. Cast to the appropriate control type, and you can access its properties, like so:

DirectCast(sender, Button).Text = "I've been clicked!"

[sIGPIC]e[/sIGPIC]

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