I get the error in these lines:

infotxtbox->Text = ("Name: Peter Jaško
			  "Rank: Main Tech Manager, Vice-Leader,
			  "Donated: ?,
			  "Exp: ?");

This code is entered in a header (Form1.h) of a Windows Form Project/Application in C++ in VC++ 2010

Regards

Edited 5 Years Ago by electrox73: n/a

I'm not sure why you thought you could fail to close a string with a double quote, then start a new string and the compiler would somehow know to concatenate them. As long as there's nothing but whitespace between two string literals you can get that effect, but the strings each have to be complete:

infotxtbox->Text = "Name: Peter Jaško "
                   "Rank: Main Tech Manager, Vice-Leader, "
                   "Donated: ?, "
                   "Exp: ?";

I'm not sure why you thought you could fail to close a string with a double quote, then start a new string and the compiler would somehow know to concatenate them. As long as there's nothing but whitespace between two string literals you can get that effect, but the strings each have to be complete:

infotxtbox->Text = "Name: Peter Jaško "
                   "Rank: Main Tech Manager, Vice-Leader, "
                   "Donated: ?, "
                   "Exp: ?";

No errors comed up but it wont start the text on a new line each:
[IMG]http://i1206.photobucket.com/albums/bb458/electrox73/Digitalizova.png[/IMG]


This is the section where the code is:

private: System::Void LoginBtn_Click(System::Object^  sender, System::EventArgs^  e) {
			
			if (usrtxtbox->Text == "Peter Jasko" && passtxtbox->Text == "alfaboss" ) {
					infotxtbox->Text = "Name: Peter Jaško"
							   "Rank: Main Tech Manager, Vice-Leader"
							    "Donated: ?"
							    "Exp: ?";


			} else {
				MessageBox::Show("Incorrect Password or Username!", "Login Failed", MessageBoxButtons::OK, MessageBoxIcon::Error);
			}
		 }

The text box control uses Windows newlines for line breaks:

infotxtbox->Text = "Name: Peter Jaško\r\n"
                   "Rank: Main Tech Manager, Vice-Leader,\r\n"
                   "Donated: ?,\r\n"
                   "Exp: ?";

Though the "proper" way to do it is with Environment::NewLine:

infotxtbox->Text = "Name: Peter Jaško" + Environment::NewLine +
                   "Rank: Main Tech Manager, Vice-Leader," + Environment::NewLine +
                   "Donated: ?," + Environment::NewLine +
                   "Exp: ?";

The text box control uses Windows newlines for line breaks:

infotxtbox->Text = "Name: Peter Jaško\r\n"
                   "Rank: Main Tech Manager, Vice-Leader,\r\n"
                   "Donated: ?,\r\n"
                   "Exp: ?";

Though the "proper" way to do it is with Environment::NewLine:

infotxtbox->Text = "Name: Peter Jaško" + Environment::NewLine +
                   "Rank: Main Tech Manager, Vice-Leader," + Environment::NewLine +
                   "Donated: ?," + Environment::NewLine +
                   "Exp: ?";

Thank you extremely much :)

This question has already been answered. Start a new discussion instead.