Results 1 to 9 of 9

Thread: Adding a toolbar to my MDI form

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    How do I add a toolbar to an MDI form, or any form for that matter? I want it to look and behave like a professional program. The toolbar size and layout of the toolbar in IE (the top toolbar with the "Back", "Forward", "Stop", "Refresh", etc. buttons) would be PERFECT! I need to know how to recreate it. Please give me code samples too. Thank you so much.

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Add a reference to Microsoft Common Controls. Toolbar control is part of that control collection. So, after you add the reference, add Toolbar control (from the Toolbox) to your form. Also, add an ImageList control to your form (it's also part of Common Controls). Right click on the new ImageList and select Properties. Select Images tab. Then click on Add button. From the CommonDialog select the icon(s) of your choice. Note that each icon will have the index (starting from 1). After selecting all the icons you want, click on OK button. Now, right click on the new Toolbar on your form and select properties. From the ImageList combobox select the name of your ImageList control.Then select Buttons tab. Click on Insert Button then fill in the Caption (if needed) Key (this must be unique to every button) and type in the number (Index of the Icon in the ImageList) in the Image textbox. Click insert button again to create another one and so on....
    Note: Always fill in the Key textbox so then you can recognize the button by checking the Key property. Lets say you added 4 buttons with the Key: Back, Forward, Refresh, Stop

    Now, programming part. You would have to double click on the toolbar, by default it will open ButtonClick event.

    Code:
    Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
        Select Case Button.Key
            Case "Forward"
                'Do your forward operation
            Case "Back"
                'Do your back operation
            Case "Stop"
                'Do your stop operation
            Case "Refresh"
                'Do your refresh operation
        End Select
    End Sub

    I hope this explains everything you need to get you started.


    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Yes, unfortunately, you don't have those controls with Learning Edition. You would have to upgrade to Professional or Enterprise Edition of VB.


    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  4. #4
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Post

    Are UserControls available in the Learning Edition? Because vbAccelerator have a great ReBar control!

    ------------------
    Yonatan
    Teenage Programmer
    E-Mail: [email protected]
    ICQ: 19552879



  5. #5

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    No, Learning Edition doesn't have User Controls, either. Is there no other way to create a toolbar?

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

  6. #6

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Hey, I found the Common Controls you were talking about Serge. They are not a reference, they are a component, and they are actually called "Microsoft Windows Common Controls" They have versions 5.0 and 6.0 and both have two parts to them. They ARE available in the Learning Edition. Thanks for the tip!

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

  7. #7
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Even if you add control by adding components, it still called reference. Just an FYI.

    Regards,

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  8. #8

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    Ok, my bad. I'm still kinda new to this, so I'm still picking up on all the terms that everyone uses. I just went by what they were called in the VB menus.

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

  9. #9

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Post

    I can't find Microsoft Common Controls in the references list. The closest I can find is Microsoft Common Dialog Controls, but that's in the COMPONENTS list. Could it be that I don't have that reference because I'm only using Learning Edition? If so, what edition do I need in order to have that reference? Thank you for your help so far.

    ------------------
    Ryan
    [email protected]
    ICQ# 47799046

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