Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Const Path As String = "Customers.xml"
Dim customers As New List(Of Customer)
Dim xmlIn As New XmlTextReader(Path)
xmlIn.WhitespaceHandling = WhitespaceHandling.None
Dim i As Integer
Dim c As Customer
i = 0
Do While xmlIn.Name <> "Customer"
xmlIn.Read()
Loop
Do While xmlIn.Name = "Customer"
Dim customer As New Customer
xmlIn.ReadStartElement("Customer")
customer.FirstName = xmlIn.ReadElementString("FirstName")
customer.LastName = xmlIn.ReadElementString("LastName")
customer.Email = xmlIn.ReadElementString("Email")
customer.Password = xmlIn.ReadElementString("Password")
customer.IDnumber = xmlIn.ReadElementString("IDnumber")
customer.LoginID = xmlIn.ReadElementString("LoginID")
xmlIn.ReadEndElement()
If customer.LoginID = loginform1.UsernameTextBox.Text Then
If customer.Password = loginform1.PasswordTextBox.Text Then
i = i + 1
c = customers.Item(i)
customers -= c
End If
Else
End If
Loop
End Sub
End Class
can someone tell me whats wrong with this code...i am trying to delete the customer that is equal to the text box's in the if statement....so i want to delete that whole customer, but with the code how i have it now it says operator"-" is not defined for types( for the line customers -=c ....i may be doing this all wrong.
if someone could look at this code and let me know how to get it to work, i would appreciate it.
THANKS
MILT

New Topic/Question
Reply




MultiQuote




|