Results 1 to 2 of 2

Thread: Re-using the Toolbar and Menu code

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    Auckland, New Zealand
    Posts
    5

    Question

    I've got an assignment where I want to have a toolbar and menus.

    The toolbar and menus will essentially do the same thing so I want to just pass the menu index that has just been selected to the toolbar_ButtonClick method as that will contain all the turning on/off of buttons etc.

    The problem is the ButtonClick method takes this parameter:
    (ByVal Button As MSComctlLib.Button)

    Does anyone know if I will have to create the code twice for the same thing or is there a way to pass it to the method? Maybe creating my own method would be the best way?

    Cheers

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    I'm not sure if I know exactly what you mean but I usually do it like this;

    Each button on the toolbar has a 'Key' property that you can type in from the properties window.

    Then, in the Button_Click event;

    Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

    Select Case Button.Key
    Case "new"
    mnuNew_Click

    Case "open"
    mnuOpen_Click

    etc..etc.etc..

    End Select

    End Sub


    Hope this helps

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

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