Solved

variable listbox in two forms

Posted on 2000-03-05
4
139 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now