|
-
Dec 5th, 2000, 09:28 AM
#1
Thread Starter
New Member
How can I have a variable that I can access in all sub procedures and forms? Is there any way that I can somehow pass a parameter to another form?
If the answer to my question involves modules can someone explain what they are and how I can use them.
Thanks to everyone who has helped with my VB problems!!!
-
Dec 5th, 2000, 09:32 AM
#2
Fanatic Member
where you have your form listing (on the right usually) right click and select add module. then, click ok for the default module.
you can declare your PUBLIC variables there, which will be available from every form class, etc.
Check out msdn.microsoft.com for more info (or your online help).
-
Dec 5th, 2000, 09:32 AM
#3
Do you want to have one variable be accessed by multiple
forms? You can declare it in a module. You would add
a module through the Projects Menu, and then declare
whatever project-wide variables in that newly created
module file.
Sherm
-
Dec 5th, 2000, 09:37 AM
#4
Frenzied Member
modules are a place where you put all your global variables and procedures
if you declare them as public
you can use them in any form or parts of the project
to add a module
on menu
Project>Add Module
then type your variables
such as
Code:
Public myVar as String
public sub SayHi()
msgbox "hi"
end sub
you can also put
public myVar as string
in a form as well
but to access this from other parts you have to call it by the form name as well
so if you put
public myVar as string
in form1
you have to call this variable as
Form1.MyVar
-
Dec 5th, 2000, 09:38 AM
#5
Frenzied Member
wow, while i was writting my answer
2 people answered..
this forum rocks
(the people on this forum make it rock)
-
Dec 5th, 2000, 09:45 AM
#6
Thread Starter
New Member
Rocking
Thanks Everyone, You are right, this forum does Rock!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|