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..

Recommended Answers

All 3 Replies

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


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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.