When I call the clear method for a ListView object, the column headers disappear - VB.Net
Good day, I've just started teaching myself VB.net. I'm trying to create a simple note keeping program.
I've come across a problem, where by I call the Clear method of the ListView object, and its column headers disappear.
screen shot of what happens
The code for button 2 is:
Private Sub Button2_Click(ByVal 开发者_开发技巧sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
lstNotes.Clear()
End Sub
Any help will be appreciated, thanks!
The Clear
method on a listview does exactly that. Just as advertised.
Use lstNotes.Items.Clear()
instead.
Augh, as luck would have it, I got the answer Just after posting.
lstNotes.Items.Clear()
use Items.clear() instead!
lstNotes.Items.Clear()
精彩评论