Solved

variable listbox in two forms

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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