enter in textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I tried to make a new line in textbox in code. I tried to do somethink like this:
textbox.Text = "01234567890abcdefghijklmnoprstvwxyz";
textbox.SelectionStart = 11;
textbox.Text += (char)13;

In textbox i cannot se new line, but i can see only symbol for new line. I don't know how can i do new line.
i test this code too:
textbox.Text += "\r\n";

but its the same.
 
Systemspecialist said:
I tried to make a new line in textbox in code. I tried to do somethink like this:
textbox.Text = "01234567890abcdefghijklmnoprstvwxyz";
textbox.SelectionStart = 11;
textbox.Text += (char)13;

In textbox i cannot se new line, but i can see only symbol for new line. I
don't know how can i do new line.
i test this code too:
textbox.Text += "\r\n";

but its the same.

Try:

textbox.Text = "01234567890abcdefghijklmnoprstvwxyz";
textbox.Text = textBox1.Text.Substring(0,11) + "\r\n" +
textBox1.Text.Substring(11);

Or better yet:

public static string InsertNewLine(string from, int at) {
return from.Substring(0,at) + "\r\n" + from.Substring(at);
}

Hope this helps

- Javier Campos
 
Back
Top