Simple Question, Please help!!! :))) 
Author Message
 Simple Question, Please help!!! :)))

Doing this rather silly school project for which we were requested to
use subroutines (with little guidance).

I'm using the command:

"GoSub ControlBrk"

I now need to program the ControlBrk part of my program and I was
thinking that would go something like this....

Sub ControlBrk    <--- what's the Syntax for this????
        code
        code
        code
Return
(which will return control to the statement following my GoSub
command)

Well I keep getting compiler errors and the darn thing won't run. I
think it's because my Syntax is wrong for the programming of the
actual subroutine. Any ideas????

Thanks,
Danny

PS - Though this program is being done in VB, right now we're only
doing hard coding without the visual aspect. VB without the V ;)



Sun, 28 Apr 2002 03:00:00 GMT  
 Simple Question, Please help!!! :)))
Thanks!

This is the exact form I was looking for. Damn that colon!!!!!!!

Quote:

>Hi Danny,

>You're confusing Subroutines with Gosubs; they're different. If
>you intend to use a Gosub like:

>GoSub ControlBrk

>then you're going to need:

>ControlBrk:    '<--- Note the Colon (:) to denote a line label
>'code
>'code
>'code
>Return

>AND, the ControlBrk routine has to be in the same sub as the
>GoSub.

>On the other hand, a better method in VB is to use Subroutines.
>Use:

>Call ControlBrk

>with:

>Sub ControlBrk()
>'code
>'code
>'code
>End Sub

>Good luck!

>Signet



Sun, 28 Apr 2002 03:00:00 GMT  
 Simple Question, Please help!!! :)))
Hi Danny,

You're confusing Subroutines with Gosubs; they're different. If
you intend to use a Gosub like:

GoSub ControlBrk

then you're going to need:

ControlBrk:    '<--- Note the Colon (:) to denote a line label
'code
'code
'code
Return

AND, the ControlBrk routine has to be in the same sub as the
GoSub.

On the other hand, a better method in VB is to use Subroutines.
Use:

Call ControlBrk

with:

Sub ControlBrk()
'code
'code
'code
End Sub

Good luck!

Signet

--

~~~~~~~~~~~~~~~~~~~~
"For every action, there is an equal and opposite criticism."


Quote:
> Doing this rather silly school project for which we were
requested to
> use subroutines (with little guidance).

> I'm using the command:

> "GoSub ControlBrk"

> I now need to program the ControlBrk part of my program and I
was
> thinking that would go something like this....

> Sub ControlBrk    <--- what's the Syntax for this????
> code
> code
> code
> Return
> (which will return control to the statement following my GoSub
> command)

> Well I keep getting compiler errors and the darn thing won't
run. I
> think it's because my Syntax is wrong for the programming of the
> actual subroutine. Any ideas????

> Thanks,
> Danny

> PS - Though this program is being done in VB, right now we're
only
> doing hard coding without the visual aspect. VB without the V ;)



Sun, 28 Apr 2002 03:00:00 GMT  
 Simple Question, Please help!!! :)))
depending on scope...

private sub yoursubname()
    'code here
end sub

You don't use 'Return' - after the sub has done its thing the program resumes
from where it was called (using 'call yoursubname').

Hope that helps.



Mon, 29 Apr 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Simple question, please help!

2. Simple question, Please Help!!! :)))

3. Simple question...please help

4. A simple question - please help

5. Very simple question - PLEASE HELP !!! :-)

6. Simple question, please help?!

7. MDI simple questions - please help

8. Simple question, please help!

9. Simple question - please help me arghhh!!!!!!!!

10. SIMPLE SIMPLE ListView Question. Please help

11. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

12. SIMPLE QUESTION, please SIMPLE ANSWER

 

 
Powered by phpBB® Forum Software