[Visual C++] Listbox selecteditem and textboxes
#1

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!

#2

C++ native or .NET ?

 

Greets

#3
.NET i guess, im using visual c++

#4

i am also interested on this.

i hope somebody can answer Smile

#5

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;
}

#6


 

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

#7

i have tried this and works fine with function ListBox1_SelectedIndexChanged

 

thanks Smile



Forum Jump:


Users browsing this thread: 1 Guest(s)