Getting and setting values
To set the value of a variable you use the following
syntax:
VariableName = Value
Where VariableName is the name of the Variable, and Value is the
value to be stored. An error will occur if Value is not the correct datatype for
that variable.
' General Declarations Section
Dim NumberofEmployees As Integer
' Form Load Procedure
Sub Form1_Load()
' Set the variable value
NumberofEmployees = 150
End Sub
This sets the value of NumberofEmployees to 150 when Form1 Loads
To get the value contained in a variable, you simply put the variablename in place of
where you would otherwise type the value:
' General Declarations Section
Dim NumberofEmployees As Integer
' Form Load Procedure
Sub Form1_Load()
' Set the variable value
NumberofEmployees = 150
End Sub
' Command Button1 Procedure
Sub Command1_Click()
Msgbox "The number of employees is: " & NumberofEmployees
End Sub
The previous code displays a message 'The Number of employees is 150' when Command1 is
clicked.
-
Posted by jawsper on 17 Apr 2004
i just found out how i can make my original idea work.
i read something about the "eval" function in the microsotf script controls, so now ik kan just say: ScriptControl1.Eval(line) and it will fin...
Posted by LouisRose on 02 Mar 2004
Hey cwamsley,
Welcome to DevFusion!
This sounds like a control array problem - if you're using VB (and not .NET) that is. You can have several controls with the same name, but with an index, lik...
-
Posted by cwamsley on 01 Mar 2004
Louis,
I am working on a somewhat similar problem (to the String to Object comments from Aug 5, 2003) and hope you can suggest a course of action.
I'm trying to create a simple way to set and mo...
Posted by Rde on 01 Mar 2004
The following lists the public, private, and default visibility
for the various elements you can declare in your programs.
Default means declaring without anything proceding (or with Dim
in the c...
Posted by LouisRose on 05 Aug 2003
I'm glad that you came up with a solution.
For muti-lingual support you best bet is to use a Resource file. Then the User's language and Locale will be detected automatically and your program will ...