Hey guys, I'm trying to get this form to display in the listbox the address from the info from the textboxes, I followed an example that uses a class to do it, but it seems I am going wrong somewhere and I don't know where. Here is the code for the class:
Public Class CLCustomer
Private pName As String
Private pAddress As String
Private pState As String
Private pCity As String
Private pZip As String
Public Property Name() As String
Get
Return pName
End Get
Set(ByVal value As String)
pName = value
End Set
End Property
Public Property Address() As String
Get
Return pAddress
End Get
Set(ByVal value As String)
pAddress = value
End Set
End Property
Public Property City() As String
Get
Return pCity
End Get
Set(ByVal value As String)
pCity = value
End Set
End Property
Public Property State() As String
Get
Return pState
End Get
Set(ByVal value As String)
pState = value
End Set
End Property
Public Property Zip() As String
Get
Return pZip
End Get
Set(ByVal value As String)
pZip = value
End Set
End Property
Public Function DisplayAddress(ByVal sep As String)
Dim strTemp As String = pName.ToString() & sep
strTemp &= pAddress.ToString() & sep
strTemp &= pCity.ToString() & ", " & pState.ToString() & pZip.ToString()
Return strTemp
End Function
Public Sub New()
End Sub
Public Sub New(ByVal vpName As String, ByVal vpAddress As String, ByVal vpState As String, ByVal vpCity As String, ByVal vpZip As String)
pName = vpName
pAddress = vpAddress
pState = vpState
pCity = vpCity
pZip = vpZip
End Sub
End Class
Here is the form code:
Public Class Form1
Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click
Dim strName As String = txtName.Text
Dim strAddress As String = txtAddress.Text
Dim strState As String = cboState.Text
Dim strCity As String = txtCity.Text
Dim strZipCode As String = txtZip.Text
Dim showAddress As New CLCustomer(strName, strAddress, strState, strCity, strZipCode)
txtList.Text = showAddress.DisplayAddress(vbCrLf)
End Sub
End Class