Results 1 to 3 of 3

Thread: Reusing same command button

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2005
    Posts
    17

    Reusing same command button

    I have a form in visual basic that has four tabs. I have different command buttons on each tab that does different things.

    I need to reuse few buttons in all of the tab, how can I reuse it.

    Thanks
    Dali

  2. #2
    New Member
    Join Date
    Jun 2005
    Posts
    15

    Re: Reusing same command button

    What doyou mean by reuse? Like if you click it, you can click it again later?

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Reusing same command button

    For the buttons that you want to use, take them off the tabs, and put them on the form itself. Then, depending on which tab is active, the button will do different things. Example:
    VB Code:
    1. Private Sub Command1_Click()
    2. 'this is only an example.  you can have the button run different
    3. 'sub routines instead of displaying a message box
    4. Select Case SSTab1.Tab
    5.     Case 0
    6.      MsgBox "You are on the first tab"
    7.     Case 1
    8.      MsgBox "You are on the second tab"
    9.     Case 2
    10.      MsgBox "You are on the third tab"
    11. End Select
    12.  
    13. End Sub

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