0

I am using ListView and with several rows. When a new item arrives, I want to replace the existing item/row if they are the same.

Is there a way that I can replace an entire row in the ListView with a new item?

gonzobrains
  • 7,856
  • 14
  • 81
  • 132
Liban
  • 641
  • 5
  • 19
  • 32
  • check this post http://stackoverflow.com/questions/1622564/c-sharp-update-a-subitem-within-a-listview – BizApps Nov 26 '12 at 07:28
  • @BizApps, thanks. but that link is about updating 'SubItems'. i have no problem with that since u can use their index. what i am asking is how can i replace or update the whole items ('SubItem[0]' to 'SubItem[5]')? basically the whole raw is replaced with new one. – Liban Nov 26 '12 at 08:40
  • Please, give a more detailed explanation. Simply replacing a row is easy: `listview.Items[index] = new ListViewItem(new String[] { text1, text2, ... });`. – Good Night Nerd Pride Nov 26 '12 at 10:25
  • actually i have an input to the program which comes like every 2 seconds. and the information is posted to the listview. it consists 4 columns. sometimes it detects the same information, so what i want is to replace the old one with the new one, and not only a subitems but the whole items(meaning the row). everytime that the program run, there will be a new input, so i need to update the existing one. – Liban Nov 26 '12 at 14:26
  • How about removing old one and adding a new? – techBeginner Dec 08 '12 at 00:33
  • actually i solved with just replacing if there is new one. – Liban Dec 10 '12 at 01:18

1 Answers1

0

Solve it by just replacing the old one if there is new..

Liban
  • 641
  • 5
  • 19
  • 32