S
supster
I'de like to change only a specific line of a textbox.
Right now I am doing:
string[] texta = mainTextBox.Text.Split(
"\n".ToCharArray() );
for ( int i = 0; i <= texta.Length-1; i++ )
{
if(i == myLine)
mainTextBox.Text += "My New Text For This Line\r\n";
else
if(!(texta.Equals("")))
mainTextBox.Text += texta.ToString() +
"\n";
}
However doing this means the whole text box is rewritten, and this is
not a small box and will contain 100+ lines. Everytime it is
rewritten I can see the scrollbar go from small to large again as the
box is being written and theres a small 0.5-1sec pause while it
loops.
I tried using the textbox.line = "My Line", but it seems that the
line array of text boxes is only meant to be read from, not to set.
Anyone have any ideas??
Right now I am doing:
string[] texta = mainTextBox.Text.Split(
"\n".ToCharArray() );
for ( int i = 0; i <= texta.Length-1; i++ )
{
if(i == myLine)
mainTextBox.Text += "My New Text For This Line\r\n";
else
if(!(texta.Equals("")))
mainTextBox.Text += texta.ToString() +
"\n";
}
However doing this means the whole text box is rewritten, and this is
not a small box and will contain 100+ lines. Everytime it is
rewritten I can see the scrollbar go from small to large again as the
box is being written and theres a small 0.5-1sec pause while it
loops.
I tried using the textbox.line = "My Line", but it seems that the
line array of text boxes is only meant to be read from, not to set.
Anyone have any ideas??