Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Resolved] Visual Basic 6 Type/End Type Frustration
#1
I'm working on a game in VB6. In a seperate module, I've declared a bunch of Public Types, then declared some variables to represent them. What I want to do is have those variables transfer over to other forms.

However, when I do try to represent the declaration (i.e., foo.bar or whatever) in another Form, VB6 complains that that declaration doesn't exist. I thought that when you declare/DIM something in a module it's automatically made public.

I've declared the type structs (if that's what you call them) before any Subs within the module.

Hope I've explained it correctly.
url=http://www.freewebs.com/boxtopstuff/]Planet Boxtop[/url] (Look out for the redesign!)
The only member of QBNF with severe "tomorrow syndrome."
Reply
#2
Its been a long time but i think you have to declare them GLOBAL in a module, ie:

Code:
Global foo As bar
EVEN MEN OF STEEL RUST.
[Image: chav.gif]
Reply
#3
That worked. Thanks.
url=http://www.freewebs.com/boxtopstuff/]Planet Boxtop[/url] (Look out for the redesign!)
The only member of QBNF with severe "tomorrow syndrome."
Reply
#4
It's better to define the stuff as public, and then use the correct naming convention to access it. For example, say you have this module called MOMO.BAS:

Code:
Public value As Integer

Public Sub mysub (ByVal i As Integer)
   Print i
End Sub

You use momo.value to read/write to the variable, or momo.mysub to call the sub,

Avoid globals, most of the time they are *not* needed.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)