Results 1 to 4 of 4

Thread: [RESOLVED] using collection

  1. #1

    Thread Starter
    Fanatic Member VBKNIGHT's Avatar
    Join Date
    Oct 2000
    Location
    Port25
    Posts
    619

    Resolved [RESOLVED] using collection

    somebody orient me on this pleaseee..

    thank you very much!


    If a post has helped you then Please Rate it!

  2. #2
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    What do you want to know?

    r0ach™
    Don't forget to rate the post

  3. #3

    Thread Starter
    Fanatic Member VBKNIGHT's Avatar
    Join Date
    Oct 2000
    Location
    Port25
    Posts
    619
    how it was use?
    how would you declare a collection?
    how can you store and retrieve.
    anything you know about...

    thank you

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    'to declare
    Private test As Collection
    
    Private Sub Form_Load()
    Dim strtest As String, itest As Integer
        Set test = New Collection 'initialize
        test.Add "A text item", "a key"
        test.Add Text1 'a textbox is added
        test.Add Command1 ' a commandbutton
        test.Add strtest ' a string variable is added
        test.Add itest ' a integer is added
        test.Remove 2 'item 2 (the textbox is removed)
        MsgBox test.Count 'the amount of items now
        test.Item(2).Value = True 'the commandbutton is clicked
        test.Remove "a key" 'the first item is removed, according to the key
        Set test = Nothing 'remove the collection
        
    End Sub
    So basically:
    1. You can store almost anything in it.
    2. You can retrieve them by either it's index or a key string.
    3. Don't use them if you
    a) aren't upto removing and adding items frequently
    b) need to access them frequently in a time critical application.
    - otherways you could use regular arrays.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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