Results 1 to 4 of 4

Thread: [2005] AccessKey for Custom Button Control

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2006
    Location
    Chennai, INDIA
    Posts
    58

    Question [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
    Last edited by vsugan_work; Jul 5th, 2006 at 05:53 AM.
    Sugan
    Chennai, INDIA.

  2. #2

    Thread Starter
    Member
    Join Date
    Jun 2006
    Location
    Chennai, INDIA
    Posts
    58

    Question 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,
    Sugan
    Chennai, INDIA.

  3. #3
    Hyperactive Member ZaNi's Avatar
    Join Date
    Jun 2006
    Location
    Australia
    Posts
    360

    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:
    1. Private Sub mybutton_Click(ByVal sender As Object, _
    2. ByVal e As System.EventArgs) Handles mybutton.Click
    3.  
    4. End Sub

    You can remove the underscore and new line there (I only provide it to keep the code smaller for posting)
    Last edited by ZaNi; Jul 6th, 2006 at 05:32 PM.
    * Don't limit yourself to sanity
    * I'd rather be optimistic and naive than pessimistic and right
    * Ask good questions, get good answers.

    My Codebank submissions:
    How to write one rountine to handle many events
    Accessing and Using variables across multiple forms
    Printing/Previewing a form or control

    Links I've "borrowed" from other people:
    vbdotnetboy - Awesome site for tips

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2006
    Location
    Chennai, INDIA
    Posts
    58

    Question 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,
    Sugan
    Chennai, INDIA.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width