*Experts* DiverDan Posted February 16, 2003 *Experts* Posted February 16, 2003 I have noticed that Listview does not have a replace option, so... How can one replace a value in the last row, 10th column in a listview with a new value? Thanks Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
a_jam_sandwich Posted February 16, 2003 Posted February 16, 2003 Dim itmX As ListViewItem ' Get the last item into itmX itmX = ListView1.Items(ListView1.Items.Count - 1) ' Change column 10s text itmX.SubItems(9).Text = "My replaced text" ' Put back into listview as last item ListView1.Items(ListView1.Items.Count - 1) = itmX Hope this helps Andy Quote Code today gone tomorrow!
*Experts* DiverDan Posted February 16, 2003 Author *Experts* Posted February 16, 2003 (edited) Thanks Andy, Your code works fantastic!!! I did notice that it did produce some screen flicker though. Is there a way to postpone the screen refresh until the listview line is replaced? (or maybe its my old Video card) Thanks Edited February 16, 2003 by DiverDan Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
a_jam_sandwich Posted February 16, 2003 Posted February 16, 2003 No its not flicker you can make it so no screen flick doesn't happen by the following code.... Dim itmX As ListViewItem ListView1.BeginUpdate() itmX = ListView1.Items(ListView1.Items.Count - 1) itmX.SubItems(9).Text = "BLUE" ListView1.Items(ListView1.Items.Count - 1) = itmX ListView1.EndUpdate() give that a go Andy Quote Code today gone tomorrow!
*Experts* DiverDan Posted February 16, 2003 Author *Experts* Posted February 16, 2003 Thanks Andy, That does the trick, it's perfect!! Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
*Experts* DiverDan Posted February 16, 2003 Author *Experts* Posted February 16, 2003 If it is possible, I have one more listview question. I'd like to save the listview contents into a serialized array each time it is updated. Then, if needed through the mnuUndo, pop it back into the listview by deserializing the array with your update method... Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.