[2005] AccessKey for Custom Button Control
I would like to simulate the accesskey property in my custom button control as in the .Net button Control
If suppose in a .Net Button Control text property is set as "&Submit", the control's load event is fired whenever we press Alt + S.
So i would like to create the same with my custom button control. Can someone provide some pointers on how to proceed .
In VB 6, we have UserControl.AccessKeys property to set the accesskey. Is there any such property in VB 2005.
Thanks,
Sugan
Re: [2005] AccessKey for Custom Button Control
Has any one come across this issue. How can i get the same feature in VB 2005.
Thanks,
Re: [2005] AccessKey for Custom Button Control
You can simply do mybutton.Name = "&Submit". This has the same effect as setting it in the designer, and should do what you're looking for.
I may have misunderstood the question though... if you are asking how to catch that event, you need to write a handler for mybutton.Click eg
VB Code:
Private Sub mybutton_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles mybutton.Click
End Sub
You can remove the underscore and new line there (I only provide it to keep the code smaller for posting)
Re: [2005] AccessKey for Custom Button Control
As i stated in the first message of this thread, i'm trying to create a custom button control. I'm not inheriting from the standard button control here. I'm drawing my own graphics for the button.
Also you cannot user '&' in the name property of a control. I hope you should have meant text property.
In my custom button control, i need to get the charcter after the '&' symbol and use it for accesskey property. How can i fire the click event when the corresponding access key is activated.
Pls reply in this regd.
Thanks,