Results 1 to 8 of 8

Thread: [RESOLVED] Adding copies of the program to a listbox

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Resolved [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.

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    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?

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: Adding copies of the program to a listbox

    Quote Originally Posted by MartinLiss View Post
    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

  4. #4

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: Adding copies of the program to a listbox

    Quote Originally Posted by MartinLiss View Post
    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. =/

  6. #6
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    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

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2007
    Posts
    41

    Re: Adding copies of the program to a listbox

    Thank you that works

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width