How to make a shoppinglist using a listbox instead of a textbox in Windows Forms Application?

Ok if I where to use a ListBox instead of textbox then how do I then input different groseries into the listbox and then how do I specificaly delete a chosen groserie from the listbox?
What are the codes for them?:

If this is how my codes look in MyForm.h : Button3 is to remove text from listbox1, And button2 is to add text into listbox.

private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {

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

Application::Exit();

}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {

String ^ in = textBox1->Text + "\r\n";
listBox1->Text += in;
textBox1->Text = "";
textBox1->Focus();

}

I dont understand! Why doesnt it show in my listbox the groserys I added from my input textbox1 ???
Last edited on
Topic archived. No new replies allowed.