locked
Goto Buttons RRS feed

  • Question

  • Hi I'm having trouble in making a button that will simply Goto a certain set of Commands because as soon I open the program the Code either just moves on straight to the Set Goto or it crashes the whole program, is there any way I could do this without this kind of trouble: 
    Monday, February 13, 2012 9:50 AM

Answers

  • Hi,

    my opinion regarding GOTO statemets is simply: Avoid them whenever possible.

    Just make some Subs e.g.
    Sub MenuNormal
      ' Commands you had there
    End Sub

    Sub Options
      ' Commands you had there
    End Sub

    And instead of these gotos you call the subs.

    Only problem left: You build also a loop - so you need a do while loop, too.

    With kind regards,

    Konrad

    Monday, February 13, 2012 10:01 AM

All replies

  • Hi,

    my opinion regarding GOTO statemets is simply: Avoid them whenever possible.

    Just make some Subs e.g.
    Sub MenuNormal
      ' Commands you had there
    End Sub

    Sub Options
      ' Commands you had there
    End Sub

    And instead of these gotos you call the subs.

    Only problem left: You build also a loop - so you need a do while loop, too.

    With kind regards,

    Konrad

    Monday, February 13, 2012 10:01 AM
  • Thank you for your help, I didn't think that I could use only SUBs for this kind of job.

    It doesn't seem for now if I need to use a loop for now but I will consider doing so If I will have anymore trouble.

    Thank you again for help :)


    ME

    Monday, February 13, 2012 10:42 AM