0

How would I write a program that writes the text in a textbox to a List Box when a button is pressed, kind of like an address book?

2
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by Boeing
0

Depends on what you are programming? *nix? MS-Windows? QT? there are lots of others too. You need to be a lot more specific about what you are coding.

Edited by Ancient Dragon: n/a

0

Right now I am working in visual C++. I have my gui set up with a textbox, button, and list box, but I'm not sure what code I have to write to get the program to work as I want it to.

0

Activate the ListBox's SelectedIndexChanged event (use listBox's properties window to do that) and the IDE will generate a function for you, then just do this:

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

Edited by Ancient Dragon: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.