Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB Command Buttons

  • 03-06-2003 03:49PM
    #1
    Closed Accounts Posts: 1


    Hi
    I'm trying to get VB command button to appear on ever tab of an already created VB application. There are 10 tabs and I want the same code to be used for the button on each tab with same button appearin gon each.
    Any advice would be really appreciated.
    Thanks in advance:)


Comments

  • Closed Accounts Posts: 1,502 ✭✭✭MrPinK


    Been a while since I did any VB, but if I remember correctly, you can create a command button on the form and then move it on top of the tabs. It's not part of any of the tabs, so switching between them will still leave the command button in the same place.

    Alternatively, you could have 10 buttons and have 9 of them just call the first one so they do the same thing. Or a control array would be even easier.


  • Closed Accounts Posts: 2,313 ✭✭✭Paladin


    Not sure if what Mr Pink said would work if you are switching between forms. What Id do (because it would mean less work finding out a better way) is have a command button on each form call a *Public* sub, ie

    command1_click()
    Call MySub()

    End sub

    Public Sub MySub()
    Code Here
    End Sub

    Actually, Mr Pink is probably right as long as the original sub is public :/
    Same thing I guess :)


Advertisement