[RESOLVED] Adding copies of the program to a listbox
I got an application that I want to make have multiple instances within one instance.
So I used "If App.PrevInstance = True Then End"
So I want to be able to clone this program, I have a listbox on each form for cloning this program, I want each instance opened to be added to each clones with the ones already added to the main listbox to be added to the next cloned programs listbox with the caption and other information.
Ok so, if that wasn't understandable I would like to make my program have multiple instances inside one instance, therefore I have a listbox to hold all the clone names in, so I want each clone opened to be added to the main listbox and the main listboxs items to be added to each clone opened of the program. So I can have like 5 instances of the program open through just one instance of it running in the task manager, and these 5 instances to show up on each listbox on each instance, to where I can open them singlely through the listbox after they have been hiden.
using: dim frmM as new frmmain
If this still doesn't make sense I'll try to describe it more.
Re: Adding copies of the program to a listbox
Sorry but it doesn't make sense to me. Why would you use If App.PrevInstance = True Then End if you wanted more than one instance of the program to run since that would prevent it? Why are you showing us dim frmM as new frmmain? are you talking about multiple instances of a form rather than a program?
Re: Adding copies of the program to a listbox
Quote:
Originally Posted by
MartinLiss
Sorry but it doesn't make sense to me. Why would you use If App.PrevInstance = True Then End if you wanted more than one instance of the program to run since that would prevent it? Why are you showing us dim frmM as new frmmain? are you talking about multiple instances of a form rather than a program?
Yes, multiple instances of a form running rather than a program. I am trying to get multiple instances of a form to show up in a listbox on each clone of the form, and to have all the clones running to show up in each listbox, that way when they get hidden someone can unhide them by double clicking the name on the listbox. Does this help? If not I'll try to provide mor edetail
Re: Adding copies of the program to a listbox
This?
Dim frm As Form
Set frm = New Form1
Form1.List1.AddItem frm.Name
frm.Show
Re: Adding copies of the program to a listbox
Quote:
Originally Posted by
MartinLiss
This?
Dim frm As Form
Set frm = New Form1
Form1.List1.AddItem frm.Name
frm.Show
Load frmM
frmMain.lstClones.AddItem frmM.Caption
frmM.Show
I tried that, it doesn't work for adding to any of the listboxes, I need it to add to all the listboxes of each form instance. =/
Re: Adding copies of the program to a listbox
Code:
Dim frm As Form
Dim intIndex As Integer
Set frm = New Form1
frm.Caption = "This is form " & Forms.Count
frm.Show
For intIndex = 0 To Form1.List1.ListCount - 1
frm.List1.AddItem Form1.List1.List(intIndex)
Next
For Each frm In Forms
frm.List1.AddItem frm.Name
Next
Re: Adding copies of the program to a listbox
Re: Adding copies of the program to a listbox
Now that we've helped you, you can help us by marking the thread as resolved. If you have JavaScript enabled you can do that easily by pulling down the Thread Tools menu and selecting the Mark Thread Resolved item.