using a variable in multiple forms 
Author Message
 using a variable in multiple forms

'A Form1 Load Event or Form1 Control Click Event could have code like
this...

A$ = hello
Form2.Text1.Text = A$

'So if From2 has a Textbox named Text1 then the contents of A$ would appear
as the text.

Quote:

>I have a variable ( Public CurrentProject as string ) declared in one
>form (in General Declarations) whereby it recieves a value from a listbox
in
>a procedure(no problem there).

>I want to use that variable in another form(in the same project) where
>it will be displayed in a textbox.
>How do I do this?
>Cheers,
>Darragh



Tue, 03 Jul 2001 03:00:00 GMT  
 using a variable in multiple forms
I have a variable ( Public CurrentProject as string ) declared in one
form (in General Declarations) whereby it recieves a value from a listbox in
a procedure(no problem there).

I want to use that variable in another form(in the same project) where
it will be displayed in a textbox.
How do I do this?
Cheers,
Darragh



Wed, 04 Jul 2001 03:00:00 GMT  
 using a variable in multiple forms

Quote:

>I have a variable ( Public CurrentProject as string ) declared in one
>form (in General Declarations) whereby it recieves a value from a listbox in
>a procedure(no problem there).

>I want to use that variable in another form(in the same project) where
>it will be displayed in a textbox.
>How do I do this?
>Cheers,
>Darragh

Put your variable in a Module. In a form, even if the variable is declared
Public, it isn't accessible if the form isn't loaded.

Hope that helps,
Merjet



Wed, 04 Jul 2001 03:00:00 GMT  
 using a variable in multiple forms


Quote:
>I have a variable ( Public CurrentProject as string ) declared in one
>form (in General Declarations) whereby it recieves a value from a listbox
in
>a procedure(no problem there).

>I want to use that variable in another form(in the same project) where
>it will be displayed in a textbox.
>How do I do this?

Qualify the variable with the name of the form in which it resides.

txtProject = frmProj.CurrentProject



Wed, 04 Jul 2001 03:00:00 GMT  
 using a variable in multiple forms
Darragh,  Simply add a .bas module to your project and declare your variable
as GLOBAL in that module.  The variable will then be available to any form
or control throughout your project.
--
Sincerely,

Todd B -  Agendum Software
** FREE Developer tools for download!  NEW release -  AG Fastform layout
tool just released!
http://www.AgendumSoftware.com

Quote:

>I have a variable ( Public CurrentProject as string ) declared in one
>form (in General Declarations) whereby it recieves a value from a listbox
in
>a procedure(no problem there).

>I want to use that variable in another form(in the same project) where
>it will be displayed in a textbox.
>How do I do this?
>Cheers,
>Darragh



Wed, 04 Jul 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Open a form and use multiple data from another (variable)form

2. Open a form and use multiple data from another (variable)form

3. Forms Collection: Using it to Open Forms by Passing the Form Name as a String Variable

4. How to declare variables set in form proc but used after form unloaded

5. Global Variables for multiple forms

6. Variables across multiple forms

7. Multiple forms with global variables

8. variables in multiple forms- new user

9. Simple Variable Question--Multiple Forms

10. Multiple Forms and Public Variables

11. Multiple Forms and Public Variables

12. variable values and multiple forms

 

 
Powered by phpBB® Forum Software