VBDOS Scope, newbie question

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
h8or
Newbie
Posts:6
Joined:Sun Aug 24, 2003 1:00 am
Location:Brazil, St. Catarina
Contact:
VBDOS Scope, newbie question

Post by h8or » Tue Jan 13, 2004 4:43 pm

In VB for windows, we have these reserved words: "PRIVATE" and "PUBLIC".
But not in VBDOS.
So, how to make variables visible in all modules?

I need an Example.
Thank.
H8OR

User avatar
frankiebaby
Global Moderator
Posts:95
Joined:Tue Apr 30, 2002 1:38 am
Location:Pennsylvania
Contact:

Re: VBDOS Scope, newbie question

Post by frankiebaby » Fri Jan 16, 2004 2:48 pm

use the SHARED keyword:


DIM SHARED Var AS INTEGER

DIM SHARED Var2 AS STRING * 5

DIM SHARED Var%

DIM SHARED Var2$

DIM SHARED Var3 AS DOUBLE

DIM SHARED Var3!

h8or
Newbie
Posts:6
Joined:Sun Aug 24, 2003 1:00 am
Location:Brazil, St. Catarina
Contact:

Re: VBDOS Scope, newbie question

Post by h8or » Sun Jan 18, 2004 1:06 am

No, wrong.
"DIM SHARED" doesn't work!
"COMMON SHARED" doen't work!
"COMMON" doen't work!

See part of my code:
------------------------------------
REM This is the "start file"
TYPE Registro
 Name as STRING * 34
END TYPE
DIM SHARED People as Registro
------------------------------------
REM This is any form
SUB asdf_click
 People.Name = "asdf"
END SUB
------------------------------------

The debugger say, People.Name is Single, not register
H8OR

h8or
Newbie
Posts:6
Joined:Sun Aug 24, 2003 1:00 am
Location:Brazil, St. Catarina
Contact:

Re: VBDOS Scope, newbie question

Post by h8or » Sun Jan 18, 2004 2:06 am

Thank you Frankiebaby!
I found the right code.
In this faq, if anyone want to know:
http://www.dossolutions.pwp.blueyonder.co.uk/vbfaq.html
Thank you! :)

H8OR
H8OR

Post Reply