|
-
Mar 5th, 2003, 08:30 PM
#1
Thread Starter
Member
Declaring Variables?
How Can I declare a variable in a sub that all subs can use?
That if you confess with your mouth, "Jesus is Lord," and believe in your heart that God raised him from the dead, you will be saved.
-
Mar 5th, 2003, 08:35 PM
#2
PowerPoster
You can create a class-level variable by declaring your variable outside of any methods, at the top of your class definition.
-
Mar 5th, 2003, 08:41 PM
#3
Thread Starter
Member
That won't work because I need to load the value of the variable from a file.
That if you confess with your mouth, "Jesus is Lord," and believe in your heart that God raised him from the dead, you will be saved.
-
Mar 5th, 2003, 08:44 PM
#4
?? why not?
Just Declare the variable outside of all subs (at the top)
then set the variable when needed?
Dim X as integer
.
.
.
.
X = whatever from your file
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Mar 5th, 2003, 08:47 PM
#5
PowerPoster
Initialize the variable in the constructor.
-
Mar 5th, 2003, 10:11 PM
#6
New Member
Declare it as a module level variable, just below the Windows Form Designer generated code.
examples.
For a module or Class level variable:
Private msinNumOne as Single
Private mbln As Boolean
Private mdblTotal As Double
For Procedure Level Variables:
Dim psinNumOne as Single
Dim pbln As Boolean
Dim pdblTotal As Double
Hopefully, this helps you.
Last edited by LFJ; Mar 6th, 2003 at 05:31 PM.
I am the Code King
-
Mar 6th, 2003, 10:19 AM
#7
Thread Starter
Member
Originally posted by [LGS]Static
?? why not?
Just Declare the variable outside of all subs (at the top)
then set the variable when needed?
Dim X as integer
.
.
.
.
X = whatever from your file
I was going to make it a constant but I guess that dons't really mater.
That if you confess with your mouth, "Jesus is Lord," and believe in your heart that God raised him from the dead, you will be saved.
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
|