B
Brian Mitchell
I have a class that contain one property, and that property contains a
collection of more properties (as follows
Public Class Class1
Private _Name As New cName
Public Property Name() As cName
Get
Return _Name
End Get
Set(ByVal Value As cName)
_Name = Value
End Set
End Property
Public Class cName
Private _First As String
Private _Middle As String
Private _Last As String
Public Property First() As String
Get
Return _First
End Get
Set(ByVal Value As String)
_First = Value
End Set
End Property
Public Property Middle() As String
Get
Return _Middle
End Get
Set(ByVal Value As String)
_Middle = Value
End Set
End Property
Public Property Last() As String
Get
Return _Last
End Get
Set(ByVal Value As String)
_Last = Value
End Set
End Property
End Class
End Class
Ok, Pretty straightforward so far and everything work great. If I want to
set the name I would simply set Name.First="whatever".
Now, how do I set up the Name property to return just the first name if the
user doesn't specify which name to return?
i.e. instead of saying something like TextBox1.Text=Name.First, how do I get
the same results by using TextBox1.Text=Name?
Is this possible or am I stuck specifically stating which name I want
returned?
Thank You!!
collection of more properties (as follows
Public Class Class1
Private _Name As New cName
Public Property Name() As cName
Get
Return _Name
End Get
Set(ByVal Value As cName)
_Name = Value
End Set
End Property
Public Class cName
Private _First As String
Private _Middle As String
Private _Last As String
Public Property First() As String
Get
Return _First
End Get
Set(ByVal Value As String)
_First = Value
End Set
End Property
Public Property Middle() As String
Get
Return _Middle
End Get
Set(ByVal Value As String)
_Middle = Value
End Set
End Property
Public Property Last() As String
Get
Return _Last
End Get
Set(ByVal Value As String)
_Last = Value
End Set
End Property
End Class
End Class
Ok, Pretty straightforward so far and everything work great. If I want to
set the name I would simply set Name.First="whatever".
Now, how do I set up the Name property to return just the first name if the
user doesn't specify which name to return?
i.e. instead of saying something like TextBox1.Text=Name.First, how do I get
the same results by using TextBox1.Text=Name?
Is this possible or am I stuck specifically stating which name I want
returned?
Thank You!!