By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,338 Members | 1,344 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,338 IT Pros & Developers. It's quick & easy.

Setting up Text Boxes

P: n/a
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?
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
> 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;
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.