Generics

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lou

    #1

    Generics

    I am new at this. I have a class named cDvice
    I want a collection of them so I do
    Public Devices As New Generic.Diction ary(Of Integer, cDevice)

    When I set one of the objects properties "Name" all the other objects "Name"
    property change

    Dim cd As cDevice = Devices(0)

    cd.Name = "HELLO"

    Now all the "cDevice" "Name" properties = "Hello" instead of just the first



    When I do

    For i = 0 To Devices.Count - 1

    Debug.Print(Dev ices.Item(i).Na me)

    Next



    they all print out "HELLO" when the others have different names?



    -Lou


  • Lou

    #2
    Re: Generics

    Never mind, I found the error!

    "Lou" <lou.garvin@com cast.netwrote in message
    news:eN9H$fvpHH A.4136@TK2MSFTN GP02.phx.gbl...
    >I am new at this. I have a class named cDvice
    I want a collection of them so I do
    Public Devices As New Generic.Diction ary(Of Integer, cDevice)
    >
    When I set one of the objects properties "Name" all the other objects
    "Name" property change
    >
    Dim cd As cDevice = Devices(0)
    >
    cd.Name = "HELLO"
    >
    Now all the "cDevice" "Name" properties = "Hello" instead of just the
    first
    >
    >
    >
    When I do
    >
    For i = 0 To Devices.Count - 1
    >
    Debug.Print(Dev ices.Item(i).Na me)
    >
    Next
    >
    >
    >
    they all print out "HELLO" when the others have different names?
    >
    >
    >
    -Lou
    >
    >

    Comment

    Working...