Results 1 to 3 of 3

Thread: Toolbars and Tabstips

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110
    Is it posible to create new buttons for toolbars and tabstrips during run-time?
    ngphuocthinh

  2. #2
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Wink Nope, I think...

    Dear ThinH,

    If you are asking about run-time adding control, then, I think you can't do anything when you run your VB coding. Because, I think, you can only add control, or something like that, in Design time.
    In run-time, you can only add some code (code that will not effect the whole project). But, if you'd like to add the code that will affect the whole project, then I think you should stop your run-time first.

    Hope will help,
    Regards,
    Wen Lie
    Regards,
    [-w-]

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Yes you can!

    This snippet of code should show you how to do it.

    The trick party is determining which button was pressed the Toolbar1_ButtonClick event.

    If the order in which button as are loaded is variable it would be best to load a unique key for each button and use a "select" on button.key so the order of the buttons on the toolbar doesn't matter

    Code:
    Option Explicit
    
    Private Sub Command1_Click()
    Dim btnX As Button
    Set btnX = Toolbar1.Buttons.Add
    End Sub
    
    Private Sub Command2_Click()
    
     TabStrip1.Tabs.Add
    
    End Sub
    
    Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    MsgBox "button " & Button.Index & " was pressed"
    Select Case Button.Index
        Case 1
        
        Case 2
    
    End Select
    End Sub
    Mark
    -------------------

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