Suren Posted September 22, 2010 Share Posted September 22, 2010 Hello guys, i'm new to c++ and need your help; i'm using Visual C++ 2008 i need your help in the following i have a ListView control in a form, Listview control has 3 columns. and i added 10 items. so the problem is i need to find out the value of the 1st column of the selected item. i need coding for that , please help me. so when i select a item out the 10 and click a button it should display the value of the 1st column inside a textbox. Thank you, Link to comment Share on other sites More sharing options...
0 Kami- Posted September 22, 2010 Share Posted September 22, 2010 MSDN Can Help Link to comment Share on other sites More sharing options...
0 Suren Posted September 22, 2010 Author Share Posted September 22, 2010 hello, thank you very much, it did not solve my problem. (it tell about adding items which i know) i want to know how to get the value of 1st column of the selected item. please help me. Link to comment Share on other sites More sharing options...
0 wrack Posted September 23, 2010 Share Posted September 23, 2010 Normally first column is the root of the ListItem so you can just do, ListView.SelectedItem.Text you should be able to use ListView.SelectedItem.SubItems[0] too. Just increment number for reading other columns. Link to comment Share on other sites More sharing options...
0 Suren Posted September 23, 2010 Author Share Posted September 23, 2010 Thank you, since it's Visual C++ it like this listViewStock->SelectedItems->ToString(); which returns the following instead of the value System.Windows.Forms.ListView+SelectedListViewItemCollection please help me. Link to comment Share on other sites More sharing options...
0 Suren Posted September 23, 2010 Author Share Posted September 23, 2010 Hello guys, i found it out my self , thank you again. here is the code for other who might search for it in the future. listView1->FocusedItem->Text; Thank you wrack and anon Link to comment Share on other sites More sharing options...
0 hdood Posted September 23, 2010 Share Posted September 23, 2010 This seems to be a C++/CLI question, not a C++ question. They are different languages. I'm not sure if you realize this, so I thought it should be pointed out. Link to comment Share on other sites More sharing options...
0 Suren Posted September 23, 2010 Author Share Posted September 23, 2010 thank you hdood, hello again, there is a another problem, i want to know whether a user has selected a item or not, and if he had selected it' run some code. does anyone know how to do that in listview ??? some like (example ListView1->isSelected()) kind of function. thank you, Link to comment Share on other sites More sharing options...
Question
Suren
Hello guys,
i'm new to c++ and need your help;
i'm using Visual C++ 2008
i need your help in the following
i have a ListView control in a form,
Listview control has 3 columns.
and i added 10 items.
so the problem is i need to find out the value of the 1st column of the selected item.
i need coding for that , please help me.
so when i select a item out the 10 and click a button it should display the value of the 1st column inside a textbox.
Thank you,
Link to comment
Share on other sites
7 answers to this question
Recommended Posts