Confused Coder
asked on
How to add multiple instance of Data class to another class
I have 2 classes similar to the 2 below where a user can have multiple emails, so how would i do this ? Would it be an array like "Private _Email As email()" or a List( of email)
and how to i add new email to the user class ?
and how to i add new email to the user class ?
Public Class user
Private _Fname As String = ""
Private _Mname As String = ""
Private _Lname As String = ""
Private _Email As ??
Public Property Fname As String
Get
Return _Fname
End Get
Set(ByVal Value As String)
_Fname = Value
End Set
End Property
Public Property Mname As String
Get
Return _Mname
End Get
Set(ByVal Value As String)
_Mname = Value
End Set
End Property
Public Property Lname As String
Get
Return _Lname
End Get
Set(ByVal Value As String)
_Lname = Value
End Set
End Property
Public Property Email As String
Get
Return _Email
End Get
Set(ByVal Value As String)
_Email = Value
End Set
End Property
End Class
Public Class email
Private _Nickname As String = ""
Private _Emailaddress As String = ""
Private _Default As Int32 = "0"
Public Property Nickname As String
Get
Return _Nickname
End Get
Set(ByVal Value As String)
_Nickname = Value
End Set
End Property
Public Property Emailaddress As String
Get
Return _Emailaddress
End Get
Set(ByVal Value As String)
_Emailaddress = Value
End Set
End Property
Public Property Default As Int32
Get
Return _Default
End Get
Set(ByVal Value As Int32)
_Default = Value
End Set
End Property
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good stuff.
If you don't instantiate the list, then it will be Null, so trying to add to Null with give your errors.
Glad you got it sorted.
If you don't instantiate the list, then it will be Null, so trying to add to Null with give your errors.
Glad you got it sorted.
ASKER