[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Accessing another forms variables... easy on again lol

Posted on 2003-03-25
8
Medium Priority
?
165 Views
Last Modified: 2010-05-01
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
0
Comment
Question by:zero303
6 Comments
 
LVL 3

Expert Comment

by:VBtom
ID: 8205262
Easy...
Declare Customer with Public (instead of Dim) in frmMaintainCustomerDetails

Then, in frmMaintainPropertyDetails you can use frmMaintainCustomerDetails.Customers(i, 0)

That's all, hope this helps you.
0
 
LVL 2

Expert Comment

by:Jacamar
ID: 8205309
Actually, you can't define arrays as project level variables.
0
 
LVL 5

Expert Comment

by:JohnMcCann
ID: 8205431
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.

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 3

Accepted Solution

by:
zero303 earned 0 total points
ID: 8205470
OK i solved it... i made a public sub and a public string called custStore


public sub getCustomerInfo (i as integer, j as integer)
custStore = Customer(i, j)
end sub

then in my property form i call frmMaintainCustomerDetails.getCustomerInfo(i, j)

then i can refer to frmMaintainCustomerDetails.custStore which now holds which ever piece of data in my array that i asked for...

thanks anyway guys...

0
 
LVL 3

Expert Comment

by:VBtom
ID: 8210345
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(..., ...)
0
 

Expert Comment

by:CleanupPing
ID: 8531625
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.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question