Good Morning.
I am a bit confused so hopefully someone has a decent answer. I have created a signature class and I want to populate a ListView with the objects from that class. I get errors on when I try to add the items to the Listview. The error states: Overload Resolution failed because no accessible 'Add' can be called with these arguments. Value of type MerchantManager.Signature cannot be converted to 'String'.
Any assistance would be greatly appreciated.
Code:Public Class Signature Private _signatureID As Integer Private _fullName As String Private _title As String Private _department As String Private _phoneNumber As String Private _faxNumber As String Private _recAddedBy As String Private _recAddedDate As Date Sub New(ByVal ID As Integer, ByVal sName As String, ByVal sTitle As String, _ ByVal sDepartment As String, ByVal sPhoneNumber As String, _ ByVal sFaxNumber As String, ByVal sRecAddedBy As String, _ ByVal sRecAddedDate As Date) MyBase.New() _signatureID = ID _fullName = sName _title = sTitle _department = sDepartment _phoneNumber = sPhoneNumber _faxNumber = sFaxNumber _recAddedBy = sRecAddedBy _recAddedDate = sRecAddedDate End Sub Public ReadOnly Property SignatureID() As Integer Get Return _signatureID End Get End Property Public ReadOnly Property FullName() As String Get Return _fullName End Get End Property Public ReadOnly Property Title() As String Get Return _title End Get End Property Public ReadOnly Property Department() As String Get Return _department End Get End Property Public ReadOnly Property PhoneNumber() As String Get Return _phoneNumber End Get End Property Public ReadOnly Property FaxNumber() As String Get Return _faxNumber End Get End Property Public ReadOnly Property RecAddedBy() As String Get Return _recAddedBy End Get End Property Public ReadOnly Property RecAddedDate() As Date Get Return _recAddedDate End Get End Property End Class Sub LoadSignatureView() ClearSignatureView() Dim cn As New SqlConnection(MerchantManagerConn) Dim dr As SqlDataReader Dim cmd As New SqlCommand("SignatureLookup", cn) cmd.CommandType = CommandType.StoredProcedure Try cn.Open() dr = cmd.ExecuteReader(CommandBehavior.CloseConnection) Do While dr.Read uxSignatureView.Items.Add(New Signature(CInt(dr("SignatureID")), CStr(dr("FullName")), CStr(dr("Title")), CStr(dr("Department")), CStr(dr("PhoneNumber")), CStr(dr("FaxNumber")), CStr(dr("RecAddedBy")), CDate(dr("RecAddedDate")))) Loop Catch ex As Exception End Try End Sub




Reply With Quote