Delete Row in Listview Control
Hello,
I am in a problem. The problem is that I have got a listview control. The control is populated with some data and the listview's view property is set to report view. What I want is that when I select a row in the listview I want to delete that row. Is it possibl. If yes please give me any idea.
Thanx in advance.
Arghya
Re: Delete Row in Listview Control
And what initiates the deletion? Button click? Listview double click?
Code:
If Not (ListView1.SelectedItem Is Nothing) Then
ListView1.ListItems.Remove ListView1.SelectedItem.Index
End If
Re: Delete Row in Listview Control
If your listview is being populated from a DB table, then you will need to delete the record from the table as well otherwise, the next time you load your listiview, that row will be back.
Re: Delete Row in Listview Control
Thanx to all for the reply and the trouble you have taken to reply to such a silly question. Now can anyone tell me how to change the forecolor and the font style of the last row of the listview control?
Thanx again
Re: Delete Row in Listview Control
ListView1.ListItems(ListView1.ListItems.Count).Bold = True
ListView1.ListItems(ListView1.ListItems.Count).ForeColor = vbBlue
Re: Delete Row in Listview Control
vb Code:
Dim i As Long
i = ListView1.ListItems.Count
ListView1.ListItems(i).Bold = True
ListView1.ListItems(i).ForeColor = vbBlue
He only wants the last row to be changed ;)
Re: Delete Row in Listview Control
Short + Efficient = Hell-Lord
Re: Delete Row in Listview Control
Quote:
Originally Posted by ashraf fawzy
Short Code + Efficient = Hell-Lord
:D Thanks :D
Re: Delete Row in Listview Control
Just make sure there's actually a listitem in the lisitems collection, otherwise you'll get an error.