LCKB
[Visual C++] Listbox selecteditem and textboxes - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: [Visual C++] Listbox selecteditem and textboxes (/showthread.php?tid=1771)



- Koko - 05-20-2013


Hi,

This has been bothering me all day lol >.<

 

Im currently trying to do something like this; when i click on a item displayed in a listbox, some textboxes would get filled with some datas corresponding to the selected item of the listbox.

 

Maybe an example will be clearer: lets say i wanna make an affinity tool. The listbox would display names & id of each affinity, and if i click on one of them, the listboxes that ive have placed somewhere else would get filled with ID, name, gifts & their affinity value for each of them (well textbox wouldnt be the best choice for that last one).

 

I found bits of code to do some stuff with the selected item in the list, but sadly couldnt find how to "link" them to my textboxes.

 

Any clue?

Thanks!




- Phantom - 05-20-2013


C++ native or .NET ?

 

Greets




- Koko - 05-21-2013

.NET i guess, im using visual c++




- soryjero - 05-28-2013


i am also interested on this.

i hope somebody can answer Smile




- Koko - 05-29-2013


Finally found something about it, with the SelectedItem function.

private: System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
String^ curItem = listBox1->SelectedItem->ToString();
textBox1->Text = curItem;
}




- soryjero - 05-29-2013



 

Finally found something about it, with the SelectedItem function.

private: System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
String^ curItem = listBox1->SelectedItem->ToString();
textBox1->Text = curItem;
}

 

thanks so much kokoul

i gonna try it Smile




- soryjero - 06-07-2013


i have tried this and works fine with function ListBox1_SelectedIndexChanged

 

thanks Smile