400lbGorilla
asked on
Public Arrays
This is probably pretty lame, but I'm stuck.. I declare this in the (General)
part of Form1:
Public Whatever(8) As Integer
I get the error:
Compile Error:
Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules.
I have VB6.0.8169 and the Public statement is the only line of code in my program (currently :) I looked in my project settings, but I didn't see anything relevent.. I'm trying to pass an array from one form to another in the w/i same project..
Thanks,
Lee
part of Form1:
Public Whatever(8) As Integer
I get the error:
Compile Error:
Constants, fixed-length strings, arrays, user-defined types and Declare statements not allowed as Public members of object modules.
I have VB6.0.8169 and the Public statement is the only line of code in my program (currently :) I looked in my project settings, but I didn't see anything relevent.. I'm trying to pass an array from one form to another in the w/i same project..
Thanks,
Lee
Add a Module to your project (Project->Add Module) and there you can declare the public array. All of your code can then access it directly.
Or declare the array as Private in your form and pass it by reference to other forms.
Option Explicit
Private a(10) As Long
Private Sub Command1_Click()
'Pass the array to another form's function
Call Form2.test(s())
End Sub
Or declare the array as Private in your form and pass it by reference to other forms.
Option Explicit
Private a(10) As Long
Private Sub Command1_Click()
'Pass the array to another form's function
Call Form2.test(s())
End Sub
Typo, should be:
Call Form2.test(a())
Call Form2.test(a())
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
in a module instead of in the form.