Setting up Text Boxes

  • Thread starter Thread starter John Morey
  • Start date Start date
J

John Morey

I have a Text Box in my program that takes user input , it has multiline set
to true , and will automatically clear the text box when the enter key is
pressed (after passing it to another "engine" class to do some processing
with) , however when the box is cleared with either the Clear() method OR by
setting Text = "" the cursor position will not return to the start of the
box , leaving the user to do this manually which is obviously not ideal.

Another part of my form displays output from the "engine" class , this is
rendered in a textbox , however i do not want the user to be able to type
into this textbox , so I set ReadOnly = true , however this makes the
background to the box white where it would fit in with the look and feel of
the application to have it white and it doesnt seem to let me change it....

Im using Visual Studio 2002 Pro (if that makes any difference)

Ideas anybody?
 
however when the box is cleared with either the Clear() method OR by
setting Text = "" the cursor position will not return to the start of the
box , leaving the user to do this manually which is obviously not ideal.

You can use the Select() method of the textBox:
textBox1.Select(0, 0);

or the Selection* properties to do the same thing.
into this textbox , so I set ReadOnly = true , however this makes the
background to the box white where it would fit in with the look and feel of
the application to have it white and it doesnt seem to let me change
it....

But it is consistent with the look and feel of Windows, which is more
important.

To work around this (if you must), just set the BackColor to white:
textBox1.ReadOnly = true;
textBox1.BackColor = Color.White;
 
Back
Top