• Print

Author Topic: Error error or just me!?  (Read 127 times)

schmoo1980

  • Jr. Member
  • **
  • Posts: 95
    • Email
Error error or just me!?
« on: April 24, 2012, 08:55:22 PM »
It says you can use GOSUB with it but everytime I do I get a "Name already in use on ### line". ### Being the line the command is on.
Now if you use a number and GOTO it works fine.

Code: [Select]
ON ERROR GOSUB ErrorControl
I have tried other names for the sub but always with the same result.

Thanks for any help.

Schmoo1980

mcalkins

  • Hero Member
  • *****
  • Posts: 1279
    • qbasicmichael.com
    • Email
Re: Error error or just me!?
« Reply #1 on: April 24, 2012, 08:59:35 PM »
What says you can use GOSUB? The wiki says you can't.

Regards,
Michael
The QBASIC Forum Community: http://www.network54.com/index/10167 Includes off-topic subforums.
QB64 Off-topic subforum: http://qb64offtopic.freeforums.org/

Clippy

  • Hero Member
  • *****
  • Posts: 16446
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
    • Email
Re: Error error or just me!?
« Reply #2 on: April 24, 2012, 09:05:38 PM »
Use GOTO with a line label with the sub's name. I once asked Galleon if we could use a SUB with ON ERROR, but he never got around to allowing it.
QB64 WIKI: Main Page
Download Q-Basics Code Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
Download QB64 DLL files in a ZIP: Program64.zip

schmoo1980

  • Jr. Member
  • **
  • Posts: 95
    • Email
Re: Error error or just me!?
« Reply #3 on: April 24, 2012, 09:06:16 PM »
The status window at the bottom says, "Expected ON expression GOTO/GOSUB label, label,...  on current line"

Guess I should pay attention to the wiki. I haven't been programming in months. :P

schmoo1980

  • Jr. Member
  • **
  • Posts: 95
    • Email
Re: Error error or just me!?
« Reply #4 on: April 24, 2012, 09:06:42 PM »
Awesome. Thanks Clippy!

  • Print