How make a new line in textBox in Windows Forms Application?

May 7, 2017 at 11:10am
I dont know how to create a shopping list in Windows Forms Application C++ in Visual Studio 2015. I have learned the basics about C++, but they dont seem to help me here when I am trying to create an windows app.

This i how a part of the MyForm.h-file look for my Windows Forms application:

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

String ^ in = textBox1->Text;
textBox2->Text = in;
textBox2->Text += "\r\n";
textBox1->Text = " ";


The start new line funktion does not work, and I dont know why? though I followed the instruktions here in cpluscplus.
The second thing I want to know is what to do so that after I have typed in something in the shoppinglist how do I make it so that the program focuses back on textBox1 where you input the different grosery stuff for the shoppinglist?
Last edited on May 7, 2017 at 11:22am
May 7, 2017 at 11:27am
I followed the instruktions here in cpluscplus

Windows form apps are a totally different beast.
Try this:
1
2
3
4
  String ^ in = textBox1->Text + "\r\n";
  textBox2->Text += in;
  textBox1->Text = "";
  textBox1->Focus();
May 7, 2017 at 11:51am
THANKS very much it worked! =DDDDDD
May 7, 2017 at 12:17pm
I need help in how to delete a specific text in my shoppinglist. I know how to clear the whole list, but what I am looking for is to only delete on specific text in the shoppinglist. Thanks!

This i how a part of the MyForm.h-file look for my Windows Forms application:

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

textBox1->Text = " ";
textBox2->Text-> Remove(textBox2->Text);
}


It doesnt seem to work, meaning the funktion abow doesnt work. I want to specificaly delete a text in my shoppinglist(texBox2). So how do you do that???
Topic archived. No new replies allowed.