Results 1 to 4 of 4

Thread: Collections

  1. #1

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674
    I'm trying working with a collection. Each item I add to a collection has three textboxes of info and text1 is added to a listbox. I'm trying to figure out how, when I click on a name in the list box to show all three textboxes of info for that item. I hope I made that clear enough. This is the first collection I've used.

    Thanks,

    JO

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    How are you passing the values and how do you want them returned?
    Perhaps your code would help get an answer.
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Fanatic Member joltremari's Avatar
    Join Date
    Sep 2000
    Location
    Mississippi
    Posts
    674
    Don't really have any code yet, Im not sure how to start this.
    There are two forms:

    Form1 Code:
    Private Account As Collection

    Private Sub Form_Load()
    Set Account = New Collection
    End Sub

    Private Sub cmdAdd_Click()
    Dim frmAccount As New frmAccount
    frmAccount.Show
    End Sub

    Private Sub cmdExit_Click()
    End
    End Sub


    Form2(frmAccount) Code:

    Private Sub Command1_Click()
    Account.Add (Text1)
    Form1.lst1.AddItem (frmAccount.Text1)
    End Sub


  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Based on what you've given here is my version of what you want to happen..However, you haven't said anything about the other 2 textboxes.
    Code:
    'add a bas module and put this in it
    Option Explicit
    
    Public Account As Collection
    
    '************************************************
    
    'this code goes in form1
    'form1 has a listbox, 3 textboxes, 2 command buttons
    'list1, command1, cmdExit,  text1, text2,text2
    
    
    Option Explicit
    
    Public Account As Collection
    
    Private Sub Command1_Click()
      Form1.Visible = False
      frmAccount.Visible = True
    End Sub
    
    Private Sub cmdExit_Click()
    
    Dim Form As Form
    For Each Form In Forms
    Unload Form
    Set Form = Nothing
    Next Form
    
    End Sub
    '***************************************************
    'form2 has 2 command buttons,
    'command1, command2
    
    Private Sub Command1_Click()
    'add the text of form1 to the collection account
    'add the 1st item of the collection to the listbox on form1
        Account.Add Form1.Text1
        Form1.List1.AddItem Account(1)
    End Sub
    
    Private Sub Command2_Click()
    'move from form to form
        frmAccount.Visible = False
        Form1.Visible = True
    End Sub
    
    Private Sub Form_Load()
    'set the collection and add text to form1.textbox
        Set Account = New Collection
        Form1.Text1 = "Help Me Out"
    End Sub



    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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