|
-
February 28th, 1999, 02:21 AM
#1
Variable declaration
Hello,
It it true that variables declared in main form with Public statement
should be used with its form name in other succeeding forms or is there
any other way to call the Public variables just by name.
What about Global statement, Please help me.
Waiting for reply
Thanks in advance
Prashant.
Prashant Joshi
Itreya Technologies Pvt. Ltd.
www.itreya.com
-
February 28th, 1999, 12:54 PM
#2
Re: Variable declaration
Prashant,
Try putting your public variables in a module file. Global/Public arrays
can also be put in a module file.
Good Luck,
Terry
-
March 1st, 1999, 12:52 AM
#3
Re: Variable declaration
I don't think you can call without formname. I think it becomes kind of property of your form (class).
-
March 1st, 1999, 06:47 AM
#4
Re: Variable declaration
Hi
Since VB4, VB now treats all components as a Class - (except for Code modules).
You can create instances of Forms and access their properties just like a class module :
Dim mFrm As Form1
Set mFrm = New Form1
MsgBox mFrm.Width
or
With mFrm
MsgBox .Width
MsgBox .Height
End With
If you want to use a global variable - place it in a BAS module using 'Public' as the keyword. This can then be accessed from Forms/Classes/UserControls/Whatever in your project.
Regards
Chris Eastwood
CodeGuru - the website for developers
http://www.codeguru.com/vb
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
|