Solved

variable listbox in two forms

Posted on 2000-03-05
4
149 Views
Last Modified: 2010-05-02
i use a object filelistbox and dirlistbox in my form.

i want to use a result of a filelistbox and dirlistbox in two different forms or in a menue.

i found out, that the variable filelistbox or dirlistbox is only available in one form and when i select the other form with the menu i can not select the filelistbox or dirlistbox of the first form.

but i will use the Contents of the two objects from the menu of the other form.

i tried to create a new filelistbox and dirlistbox with a public variable in a common module, like:

public filelistb as filelistbox

but i don't know how i can use this object.

i hope somebody can understand what i mean and can help me here
fragen
0
Comment
Question by:fragen
4 Comments
 
LVL 2

Expert Comment

by:orbitaltech
ID: 2585850
I think what you want to do is reference the filelistbox on form1. Try doing this:

Dim MyFileListBox as Form1.FileListBox

You should now be able to reference the filelistbox on form1

Hope this helps
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2586018
To reference the FileListBox on Form1 use for example:

Form1.File1.Pattern = "*.txt"
sFilename = Form1.File1.filename
0
 
LVL 4

Expert Comment

by:amit_panjwani
ID: 2586712
Instead Try this

' in Module1  Decalre Public Variable

Public MyVar as Variant

When U Get val from DirListBox Assign that value to MyVar
n Use That Value In Form2
0
 
LVL 3

Accepted Solution

by:
Gunsen earned 100 total points
ID: 2586965
By using explicit notation u can address the box of the other form from wherever u like :

Print  Form1.File1.ListCount
Print  Form2.File1.ListCount
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

756 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