Click to See Complete Forum and Search --> : Variable in form used in module?


wilton
January 6th, 2000, 08:27 PM
I'm using a variable declared in declarations on a frmMain. I'm trying to use that same variable in a module, but the code can't see it. What's the correct syntax for this?

valkyrie
January 6th, 2000, 08:39 PM
Ok,
Let's just say you have another form called frmB which wants to use a variable in frmMain. So here is the variable declaration section in frmMain:


option Explicit
public strVar as string




So, if you want to use "strVar" in frmB, you have to declare this variable in frmMain as "Public".

Now, let's use it for something in frmB:


frmMain.strVar = "Hello World!!"




Hope this helps... =)

____________________________________
The VB Bugs in my Life...

wilton
January 6th, 2000, 08:56 PM
Helped 100%. Thank you.