Click to See Complete Forum and Search --> : Public Variables
December 26th, 1999, 03:55 PM
I am cerating a PUBLIC variable as follows:
public abc as string
I populate that variable in Form1 and try to access it in a Form2 procedure, but it does not appear to contain any data in Form2....
Ruth Glushkin
December 27th, 1999, 01:01 AM
It is preferrable to define all the public variables, subroutines and functions in the Module level, but it
doesn't mean that you did something wrong. Check all the subs/functions of Form1 and Form2.
Maybe, somewhere, by mistake, you define the same variable as Private. That's why your public
variable didn't receive the desired value. The another reason could be that you loading Form2 before
giving any value to this variable. If you check everything and still have the same problem, you may
e-mail me your project and I'll try to help you.
Good Luck!
santulan
December 27th, 1999, 02:39 AM
May be because you do not refering the form.
You have declared abc in form1 as public.
To refer it in form2
use
form1.abc = something
Santulan
December 27th, 1999, 06:20 AM
In Form2 I am referring to it as frmForm1.text=abc
Jean Spector
December 27th, 1999, 12:04 PM
Then you could try Form1.Text=Form1.Abc from Form2 if both Text and Abc are public (BTW, it's highly recommended not to use reserved words as user defined variables - I mean Text). If I understood you right it must help if not. . . I tried. Good luck.
Jean Spector
Tech Support Team Leader, CET
mage@lycosmail.com
(in VB from 11/1999)
December 28th, 1999, 12:24 AM
hi
see pal!! u gotta add a module to ur existing project ,right click on the project explorer where form is there then u will find a option add,go and add the option MODULE not anyother.. then declare that varibale in that module
it will be globally accepted wherever u populate it
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.