![]() |
|
[C#] ListView change item text - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] ListView change item text (/showthread.php?tid=5230893) |
ListView change item text - IAmBabyFinn - Apr 8, 2016 So i have an listview in gui and i want to change text in (lets say column num 2And row 1) How would i do that ? I realy want to get 1 line code because i am going to change text within 10 sec like 100 times. Something like listview.items[row].column[1].text="new text"; If there would be something like that i would be realy happy. * - GuRuHaX - Apr 8, 2016 I think something like that should do it : PHP Code 🤝 * - 0xDEAD10CC - Apr 10, 2016 (Apr 8, 2016 12:10 PM)GuRuHaX Wrote: I think something like that should do it : This ADD's a new ListViewItem to the ListView -- not what he wanted. OP: Column 2, Row 1, translates to ListViewItem index 0, and SubItem index 1... Code listview.Items[0].SubItems[1].Text = "new string";I believe the subitem indexing is preserved as well even with column re-ordering. * - GuRuHaX - Apr 10, 2016 (Apr 10, 2016 12:07 AM)0xDEAD10CC Wrote: This ADD's a new ListViewItem to the ListView -- not what he wanted. Oops 😊 indeed , sry for the misunderstanding ! 🤝 * - Odus - Apr 10, 2016 (Apr 8, 2016 11:42 AM)IAmBabyFinn Wrote: Something like listview.items[row].column[1].text="new text"; Switch column with SubItems and fix the casing and you've got it. ^^ * - IAmBabyFinn - Apr 10, 2016 (Apr 10, 2016 12:07 AM)0xDEAD10CC Wrote: This ADD's a new ListViewItem to the ListView -- not what he wanted. I thank you for this . This had gotten me so much headache because other way i found was to loop all items and check if it is in column 1 and row1. Thanks :) |