I'm using the Visual Basic that comes with Visual Studio 2012 Utlimate, and everything I find online doesnt ever work. I am simply trying to make it to when a button is clicked the rows that are checked get deleted.

Do While TodaysTrans.SelectedItems.Count > 0

Recommended Answers

is your problem with the code to delete rows, or tying the code to the button click?

Jump to Post

All 4 Replies

is your problem with the code to delete rows, or tying the code to the button click?

Mainly the code to delete rows, I have a form that has a ListView for the data to populate along with checkboxes.

Here's an an Example I was lookin at:

And what I have below wont let me use the ListView functions without adding a random 0 after each call?

    Private Sub RemoveTr_Click(sender As Object, e As EventArgs) Handles RemoveTr.Click
        Dim temp As String
        Do While (TodaysTrans.SelectedItems.Count > 0)
        temp = TodaysTrans.SelectedItems.Item(0).ToString(0)
        Control.MySQLConductor("ryan", "Doyle2233", "localhost", SetL, "DELETE From list WHERE Name= @one", temp)
        Control.MySQLListAdd("ryan", "Doyle2233", "localhost", SetL, "list", "Name", TodaysTrans)
    End Sub
End Class

You could try something like this:

        For Each lvi As ListViewItem In ListView1.SelectedItems
Be a part of the DaniWeb community

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