variable listbox in two forms

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
fragenAsked:
Who is Participating?
 
GunsenConnect With a Mentor Commented:
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
 
orbitaltechCommented:
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
 
Erick37Commented:
To reference the FileListBox on Form1 use for example:

Form1.File1.Pattern = "*.txt"
sFilename = Form1.File1.filename
0
 
amit_panjwaniCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.