Results 1 to 6 of 6

Thread: Using the ToolBar . . . giving the buttons some code. .. how do u do it?

  1. #1

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    hey marty . .. i used this
    Code:
    Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case LCase(Button.Key)
    Case "Open"
    mnuOpen_Click
    Case "Save"
    mnuSave_Click
    End Select
    end sub
    and it still doesn't do anything what am i doing wrong?
    the mnuOpen and the mnuSave work when u go to file and then click them but wjhen i put them on toolbar they do nothing when i click the toolbar icon . .. did i select Case somthign wrong? like is it suppose to be set at Select Case LCase(button.key)?


    ------------------
    Cory Sanchez
    Young Student
    ICQ#: 18640149



  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Replace the Select Case LCase(Button.Key) with Select Case Button.Key. You use "Open", for example, in your Select Case statement, so just make sure that the value of the Key in the button's properties is "Open", so that it matches exactly.

    ------------------
    Marty

  3. #3

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    oh i c now! thanks again!

    ------------------
    Cory Sanchez
    Young Student
    ICQ#: 18640149



  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    No you don't "c" now, you VB now

    ------------------
    Marty

  5. #5

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    Hello i am making a simple word processor but i want to make it so the user cna use the toolbar . .. i use an image list and i know how to load the images into the toolbar but i don't know how to make the toolbar respond to the click event . . . how do i make it so i can give the toolbar buttons code to do the same as the mnuFile and so on does? i hope i explained it enough.

    Thanks for your time.


    ------------------
    Cory Sanchez
    Young Student
    ICQ#: 18640149



  6. #6
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    Here's how:
    Code:
    Private Sub tbarButtons_ButtonClick(ByVal Button As ComctlLib.Button)
       
        Select Case LCase(Button.Key)
            Case "new"
                mnuNewSystem_Click
            Case "open"
                mnuOpen_Click
            Case "save"
                mnuSave_Click
            Case "print"
                mnuPrint_Click
        End Select
    
    End Sub
    The items like "save" and "print" are the "Key" property of the various buttons.

    ------------------
    Marty

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