Adding a right-click function to a control

I hope someone can help me out with this.

I'm trying to add a function to a button when it's right-clicked , but I can't find any way to do it.

Thanks (in advance!) for helping.


Answer this question

Adding a right-click function to a control

  • robinjam

    unfortunately as you guessed, this isnt the correct place for VB6 questions and is for .NET only. Best place, if you havent already, is to post here:

    http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx dg=microsoft.public.vb.general.discussion&cat=en_us_ab067bc0-bda5-4921-a1ec-e76402873945&lang=en&cr=us



  • bayito

    Hi Suliman,

    Well use hte Mouse_Down event and you can easily determine which button is pressed and take the required action.. Hope this answers the question..

    Regards

    Ahmad

    Microsoft Student Partner - India



  • wakewakeup

    Hi Suliman Ill b glad if u mark my response as Answered.. Thanks

  • XNA Rockstar

    Hi Suliman,

    You can respond to an event other than Button_Click this will let you choose which button to respond to like middle,right,left,etc...

    Regards

    Ahmad

    Microsoft Student Partner - India



  • Sunchaser

    Thanks, I tried the mouse_up event and it works !
  • mrP

    I'm sorry but I don't actually know that, (as I'm using VB 6 (I know I shouldnt be posting here, but I can't find it anywhere else ! ) ).

    Isn't there a simple property in VB 6 that allows me to write a function when I right click a button.

    This is what I'm trying to do: When I left-click the button a few times it goes : "blue" , "green" , "yellow", "red"
    And when I right-click it, I want it to go: "red" , "yellow" , "green" , "blue" .
    Left-click to go forward and right-click to go backward.

    Thats what I'm attempting.

    Thanks

  • swg

    this is also known as a contextmenu. From the controls I have seen such as combobox, textbox, listbox, there is a property in designer view called ContextMenuStrip. Simply add a context menu control on the form, add menu items to it, program it and finally assign the control in question to the contextmenustrip you have just created

    does this give you a head start



  • Adding a right-click function to a control