1.11M Members

VB and Forms

 
0
 

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
            TodaysTrans.Items.Remove(TodaysTrans->CheckBox.Equals(true))
Loop
 
0
 

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

 
0
 

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

 
0
 

Here's an an Example I was lookin at:
http://www.codeproject.com/Tips/170900/How-to-Delete-Selected-Items-of-ListView-and-ListB

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)
            TodaysTrans.Items.Remove(TodaysTrans.SelectedItems(0))
        Loop
        temp = TodaysTrans.SelectedItems.Item(0).ToString(0)
        MsgBox(temp)
        Control.MySQLConductor("ryan", "Doyle2233", "localhost", SetL, "DELETE From list WHERE Name= @one", temp)
        TodaysTrans.Clear()
        Control.MySQLListAdd("ryan", "Doyle2233", "localhost", SetL, "list", "Name", TodaysTrans)
    End Sub
End Class
 
0
 

You could try something like this:

        For Each lvi As ListViewItem In ListView1.SelectedItems
            ListView1.Items.Remove(lvi)
        Next
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: