|
-
Jul 19th, 2000, 04:04 PM
#1
Thread Starter
Registered User
hi all...
when I use ReDim an array in Command1_Click I use it anymore in Command2_Click. How could I use it?
I'm using this code:
Code:
Dim F As Integer
Private Sub Command1_Click()
F = Val(Text1.Text) 'F is bigger than 3 for sure
ReDim a(1 To F) As String
a(3) = "Please! be saved!"
End Sub
Private Sub Command2_Click()
MsgBox a(3)
End Sub
You see, everything works fine when I'm processing the Command1_Click, but when I come to Command2, I get the "a" variable highlighted, and error that says: "Sub or Function not defined"
Any idea so I'll be able to use the array in any procedure at the form?
-
Jul 19th, 2000, 04:14 PM
#2
Fanatic Member
Did you remember to declare the a Array as public? What is it's scope?
How and where is it being declared?
-
Jul 19th, 2000, 04:36 PM
#3
Frenzied Member
just add dim a() as Integer underneath dim F as integer.
Write Option Explicit at the Top of the Code and it'll force you to declare all your variables, that way you won't get problemms like this.
-
Jul 19th, 2000, 04:43 PM
#4
Thread Starter
Registered User
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
|