Results 1 to 2 of 2

Thread: Collections?

  1. #1

    Thread Starter
    Lively Member D.Viddy's Avatar
    Join Date
    May 2003
    Location
    Soldotna, Alaska
    Posts
    108

    Collections?

    I am trying to make a new collection I think. Here is what I'm doing:

    Friend tmpCol() as collection

    But the problem is that I am trying to make it only accept a certain datatype say: System.Drawing.Icon.

    When I do this:

    Friend tmpCol() as System.Drawing.Icon

    I don't get an add subrouting in intellisense to add a new object. I'm sure none of this makes sense but I just can't figure it out.
    ~Dylan
    ~http://www.codebend.net
    ~The place for Internet Development help.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    VB Code:
    1. This is an example of how to make datatype check before adding it to the collection . There might be other ways but I've seen used commonly .
    2.  
    3. Friend mycolection As New Collection
    4.  
    5.     Private Sub AddIcons(ByVal o As Object)
    6.         If TypeOf o Is Icon Then
    7. mycolection.Add(....etc)
    8.         End If
    9.     End Sub

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