Page 1 of 1

PLEASE ANSWER ASAP!!!!!!!

Posted: Mon Aug 06, 2007 11:39 am
by Sinuvoid
how do you go back to the main moduel thing or the starting of the program after youre in a SUB??

Posted: Mon Aug 06, 2007 11:44 am
by Stoves
The F2 key switches between subs and the main program.

Posted: Mon Aug 06, 2007 4:13 pm
by Sinuvoid
Sorry but not that stoves :?
I mean when you have choice's and then you go to a sub but then i need to get back to the choice's.

Posted: Mon Aug 06, 2007 4:36 pm
by Stoves
If you're talking about this screen:

Image

Then the only key I'm aware of to get to it is the F2 key. You should also be able to use the menu options to get to it.

Image

Posted: Mon Aug 06, 2007 5:45 pm
by Nodtveidt
I understand the question, but it's impossible to explain the answer without seeing the code in question.

Posted: Mon Aug 06, 2007 6:49 pm
by Stoves
Yeah, if it's an issue with code, maybe you can post the code that's giving you problems.


I don't know if this is what you're looking for, but you might be able to use a DO/LOOP to return to your choices if it's a menu in your program.

Code: Select all

DO

'Code that display's menu and gets user input.

SELECT CASE userInput
    CASE 'choice that calls a particular SUB
        doSomething
    CASE 'choice that sets a value or calls another SUB
        something = 1
        doSomethingElse
    CASE ELSE 'default choice
        something = 0
END SELECT

END SELECT

LOOP
The code/pseudocode above will keep looping through the choices and after running a subroutine if a particular choice is made, will return to the choices.

Posted: Tue Aug 07, 2007 5:06 pm
by Anonymous
Hi,

If i understand correctly you want to know how you're code goes back to the main module when you are running the code.

Say I have a sub named DisplayText, I would call it in my main module like so

Code: Select all

call DisplayText()
Now when DisplayText is called it runs the code in DisplayText until it gets to the end of the sub (END SUB), or unless you use EXIT SUB. So say I have this code in DisplayText


Code: Select all

sub DisplayText() 
 Print "Hello, please type your name"
 input usertext$
 if usertext$ = "q" then
      exit sub
 else
      print "You enter " + usertext$
 end if
end sub
Now once the code in the sub has finished running it will go back to the main module and move to the next line of code.

Code: Select all

print "Before sub"
call DisplayText
print "After sub"
Hope this helps