zero303
asked on
Accessing another forms variables... easy on again lol
I have a form called frmMaintainCustomerDetails which has a multi-dimensional array Customer(100, 13).
Im in a form called frmMaintainPropertyDetails and i want to access Customer(i, 0) in the form above... how???
I told the guys at uni we should have done our prototype in Java!!!!
Gar
Im in a form called frmMaintainPropertyDetails
I told the guys at uni we should have done our prototype in Java!!!!
Gar
Actually, you can't define arrays as project level variables.
In frmMaintainCustomerDetails add this code
Public Property Get Customer(ByVal Index1 as integer, ByVal Index2 as integer) as String
Customer = Customers(Index1,Index2)
End Property
Public Property Let Customer(ByVal Index1 as integer, ByVal Index2 as integer, Byval StrCustomer as String)
Customers(Index1,Index2) = StrCustomer
End Property
I think that is what you require.
Public Property Get Customer(ByVal Index1 as integer, ByVal Index2 as integer) as String
Customer = Customers(Index1,Index2)
End Property
Public Property Let Customer(ByVal Index1 as integer, ByVal Index2 as integer, Byval StrCustomer as String)
Customers(Index1,Index2) = StrCustomer
End Property
I think that is what you require.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi.
I was wrong indeed, you cannot declare an array public in a form.
But you can in a module, so an easier solution is:
add a module and declare Customer in the module (not in frmMaintainCustomerDetails ):
Public Customer(100, 13) As String
Then, you can give it values in frmMaintainCustomerDetails and access them in frmMaintainPropertyDetails by just using Customer(..., ...)
I was wrong indeed, you cannot declare an array public in a form.
But you can in a module, so an easier solution is:
add a module and declare Customer in the module (not in frmMaintainCustomerDetails
Public Customer(100, 13) As String
Then, you can give it values in frmMaintainCustomerDetails
Hi zero303,
This old question (QID 20562780) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
This old question (QID 20562780) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
Declare Customer with Public (instead of Dim) in frmMaintainCustomerDetails
Then, in frmMaintainPropertyDetails
That's all, hope this helps you.