Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change text in textbox to uppercase while typing? 1

Status
Not open for further replies.

Amesville

Programmer
Oct 10, 2011
93
US
Hi Folks

I'm working on a small app that allows users to type alphanumeric values into a series of text boxes. I would like to automatically convert any lowercase text (a-z) typed into the box into uppercase (A-Z) as they are typing it.

I already know about the string.ToUpper() function, but my problem is that I can't seem to make it work. I'm trying to define the sender object like this:

TextBox txt = (TextBox)sender;

and then to change the text in the textbox thusly:

txt.Text.ToUpper();

But that is not working. It's telling me that the object txt is a textbox but when I try to address methods on it it says that I can't.

What am I going wrong?

Craig
 
Thanks Tom, I had just found it and was about to come and say thanks but I figured it out... Seriously thank you though.

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top