mainrotor
asked on
I need help making a collection from a class in VB.Net
Hi Experts,
I have created the class below in my VB.Net project.
I want to use the class listed below from within another class and make a collection of that class. How do I do this?
I want to also loop through a dataset to load values to my class. How do I do this?
Class I want to make a collection of:
Thank you in advance,
mrotor
I have created the class below in my VB.Net project.
I want to use the class listed below from within another class and make a collection of that class. How do I do this?
I want to also loop through a dataset to load values to my class. How do I do this?
Class I want to make a collection of:
Public Class ToLoadImages
Private m_imgID As String
Private m_imgName As String
Public Property ImgID() As Integer
Get
Return m_imgID
End Get
Set(ByVal value As Integer)
m_imgID = value
End Set
End Property
Public Property ImgName() As String
Get
Return m_imgName
End Get
Set(ByVal value As String)
m_imgName = value
End Set
End Property
End Class
Thank you in advance,
mrotor
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Whilst reading your dataset inside the loop create a new img, fill in the values then Add to the collection. Do not reuse the same instance of image otherwise you will end up with multiple entries in the list but all the final image you added. (Reference types)