Reputation: 1559
I do not know the exact name of what I am trying to do so bear with me... Basically I am trying to create a object(s) which will hold multiple properties.. Each one will be unique. Below is what I have so far..
Public Class TestingProperties
Private m_TestId As Integer
Public Property TestId() As Integer
Get
Return m_TestId
End Get
Set(ByVal value As Integer)
m_TestId = value
End Set
End Property
Private m_TestName As String
Public Property TestName() As String
Get
Return m_TestName
End Get
Set(ByVal value As String)
m_TestName = value
End Set
End Property
End Class
Then I the below will basically be what is contained in each object of the above as a property...
Dim x As TestingProperties
x = New TestingProperties
x.TestName = "N/A"
x.TestName = "Name1"
x.TestName = "Name2"
x.TestId = "0"
x.TestId = "1"
x.TestId = "2"
obviously this does not work because the last testId and last TestName overwrites everything contained in the object properties. Once I get this figured out the data will be provided through a SQL stored proc but the format should still be similar... Any ideas in this feat that I should have learned long ago.
Upvotes: 0
Views: 2768
Reputation: 1069
Dim x As New List(Of TestingProperties)
For i = 0 To 9
Dim newx As New TestingProperties
newx.TestId = i
newx.TestName = "Name " & i
x.add(newx)
Next
Now you have 10 unique properties. You may access them like:
Console.WriteLine(x(0).TestId)
Upvotes: 4