winforms - How to get selected list item in listview by using selected index -
i have selected index value in integet 'i' variable.
i have written below code listview selected item index of selected item...
string previtem = listview1.items[i - 1].tostring();
value of previtem="parent1"
string curritem = listview1.items[i].tostring();
value of curritem="parent2"
messagebox.show(previtem+" "+curritem);
but displayed like...
listviewitem :{parent 1} listvieitem :{parent 2}
i want output shows strings in previtem , curritem (parent1 , parent2)
use below variable assignment, output
string previtem = listview1.items[i - 1].text.tostring(); string curritem = listview1.items[i].text.tostring();
winforms
No comments:
Post a Comment