Hi all,
I am trying to write a string to a multiline textbox but apearently my code doesnt do as i want...
This is the code i am using :

textBox9>Lines[0]="Succes";

But when the code executes nothing happens in the textbox, everything just stays thesame :S
Am i doing something wrong?, if i am pleas point me out and help me fix this error.
Thanks in advanced.

First, try:

textBox9->Lines[0]="Succes";

If that doesn't work, post the rest of the code/function.

The whole function is like this

private: System::Void button8_Click(System::Object^  sender, System::EventArgs^  e)
		 {
			textBox9->Lines[0]="Succes";
		 }

textBox1->Lines = gcnew array<String^> {"Success"}; is the command that you need. Buried in the MSDN entry for Lines I found the following:

Note:

By default, the collection of lines is a [B]read-only[/B] (my emphasis added) copy of the lines in the TextBox. To get a writable collection of lines, use code similar to the following: textBox1.Lines = new string[] { "abcd" };

textBox1->Lines = gcnew array<String^> {"Success"}; is the command that you need. Buried in the MSDN entry for Lines I found the following:

Note:

By default, the collection of lines is a [B]read-only[/B] (my emphasis added) copy of the lines in the TextBox. To get a writable collection of lines, use code similar to the following: textBox1.Lines = new string[] { "abcd" };

i tried that and it worked but how do i change a specific array line?
for example line 3,etc
and can i get the msdn link :) ?
Thanks in advanced.

Sure here's the link.

To get a specific member you just need to rebuild the string array each time. Will get it in the next post hang on.

So to get the fourth and sixth (3rd and 5th in the array) positions you'd need something like textBox1->Lines = gcnew array<String^> {"","","","fourth","","sixth"}; Apologies for the edits on the last one.

Thank you very much

Apologies for the edits on the last one.

No problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.