usvpn Posted March 18, 2011 Posted March 18, 2011 (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 March 18, 2011 by snarfblam Quote
Leaders snarfblam Posted March 18, 2011 Leaders Posted March 18, 2011 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!" Quote [sIGPIC]e[/sIGPIC]
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.