Public Variable help please
Oopps. Posted this in wrong category initially!
Can anyone PLEASE help with what I am sure is a simple problem! I have a VB6 project where the initial form is called 'menu.frm'. In the 'General Declarations' section of this form I have the following lines :
option Explicit
public superpass as string
In the 'Form Load' event of 'menu.frm' I assign a value of "test" to 'superpass'. If I reference 'superpass' within any code inside 'menu.frm' I get the correct contents (The string "test"). If I reference 'superpass' from code inside another form in the same project it is empty!! Please help - I want to be able to create a global variable at the start of my program that is available anywhere.
Re: Public Variable help please
Public in general section of a form module becomes a property of that form. If you need a global variable inside your project, you may add a .bas module (=standard module) and declare there that variable as Public
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
Re: Public Variable help please
Try using menufrm.superpass