hello guys

I need help Please.. What I want is that when i select the data from the listview1 it will also delete the corresponding data in the database im using mysql database...these is my code

Dim Button = MessageBox.Show _
        ("Are you sure you want to delete this Data?", _
        "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)

          If Button = Windows.Forms.DialogResult.Yes Then

        da.Update(ds, "walkindata")
        If Not ListView1.SelectedItems.Count = 0 Then
           MsgBox("customer removed in the list.", MsgBoxStyle.Critical)

        MsgBox("No Customer Selected.", MsgBoxStyle.Critical)

        End If
        MsgBox("delete is cancel", MsgBoxStyle.Information)

        End If

so far that is my code..it work but in order to delete the data from database i use the datagridview does not what i want , what I want is that when i select the item in the listview the corresponding data in the listview it will also delete in database... that code i post is that u need to select the data in listview1 and also select the data from the datagridview in order to delete the data in database..

6 Years
Discussion Span
Last Post by roottybrian

what exactly is the event you want to use for the delete action and in what control? listview or datagridview?

Edited by roottybrian: clarification


To delete the record from the database u need to formulate the delete query after selecting the item in the listview. Something like "delete from table where.." then execute the query. After that you can refill your ds variable and reload the listview items.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.