Easy question for the experts 
Author Message
 Easy question for the experts

I need to pass an integer variable from one form to another. How do I do
this? I couldn't find anything in my book about it! Perhaps I was
overlooking the obvious?
Thanks for any help,
Rob



Sat, 17 Jun 2000 03:00:00 GMT  
 Easy question for the experts

Just make the variable global

Public a As Integer
Public b


Quote:
> I need to pass an integer variable from one form to another. How do I do
> this? I couldn't find anything in my book about it! Perhaps I was
> overlooking the obvious?
> Thanks for any help,
> Rob



Sun, 18 Jun 2000 03:00:00 GMT  
 Easy question for the experts

You can declare a global variable that is outside the form, you can also
make use of static variables, but the simplest of all, by way of cheating
would be passing the value in the form's tag property, and just retrieve it
from the other form.

Quote:

> I need to pass an integer variable from one form to another. How do I do
> this? I couldn't find anything in my book about it! Perhaps I was
> overlooking the obvious?
> Thanks for any help,
> Rob



Sun, 18 Jun 2000 03:00:00 GMT  
 Easy question for the experts

Quote:

>I need to pass an integer variable from one form to another. How do I do
>this? I couldn't find anything in my book about it! Perhaps I was
>overlooking the obvious?
>Thanks for any help,
>Rob

Assuming VB5, using a global variable is considered bad form these
days. You can declare a public variable within the form that you want
to receive the value, and set it before showing the form.

If form1 shows form2, then have a public variable in form2:

Public myVar as integer ' or whatever

and in form1, just do:

form2.myVar = 6
form2.show

and form2 can start up and check the value of myVar.



Sun, 18 Jun 2000 03:00:00 GMT  
 Easy question for the experts

Quote:

>I need to pass an integer variable from one form to another. How do I do
>this? I couldn't find anything in my book about it! Perhaps I was
>overlooking the obvious?
>Thanks for any help,
>Rob

Use Global variables

in your *.bas module enter this type of line:

Global whatever as variant

Now this vairable is available to all forms in your project.



Sun, 18 Jun 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. EASY EASY EASY question

2. help easy easy question

3. easy filecopy question...but maybe not so easy

4. Duplicate database fields in report expert, select expert...

5. Another question for the experts!!

6. 3 expert questions about newbie stuff

7. Expert Advice Requested: Automation / GetObject Question

8. question for an expert?

9. A question only for expert!!!

10. A question only for expert!

11. A QUESTION ONLY FOR EXPERT

12. VB questions for the Experts: Complete NULL record.....

 

 
Powered by phpBB® Forum Software