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

Converting to Upper Case

P: n/a
How do I convert a field that is filled in to uppercase within the C3 code?
I see the ToUpper in there, but how do I get the text box to convert this to
upper when you change focus or move to another text box?

Nov 16 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Brian,

If you mean a Winforms TextBox, wouldn't it be eaiser to just set the
CharacterCasing property to CharacterCasing.Upper, so that all input
is automatically converted to upper case?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2

P: n/a
Yes that is what I am trying to do, but can't figure out where or how to get
that in there to get it to work. this is a Web Form so I am thinking that
this is what the problem is.
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
Brian,

If you mean a Winforms TextBox, wouldn't it be eaiser to just set the
CharacterCasing property to CharacterCasing.Upper, so that all input
is automatically converted to upper case?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #3

P: n/a
Okay here is the code that I came up with, but it doesn't change the
existing information in the text box on focus change.

string EventName;

EventName = txtEventName.Text;

EventName.ToUpper();

txtEventName.Text = EventName;

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
Brian,

If you mean a Winforms TextBox, wouldn't it be eaiser to just set the
CharacterCasing property to CharacterCasing.Upper, so that all input
is automatically converted to upper case?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #4

P: n/a
Brian

try this:

txtEventName.CharacterCasing=CharacterCasing.Upper ;

Note however, that only typed characters will be converted. If you do
something like txtEventName.Text="lowercase string"; contents of text box
will stay in lower case. I think it is small bug in TextBox control, anyway
that's how it is.
HTH
Alex

"Brian Conway" <Br**********@qwest.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Okay here is the code that I came up with, but it doesn't change the
existing information in the text box on focus change.

string EventName;

EventName = txtEventName.Text;

EventName.ToUpper();

txtEventName.Text = EventName;

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
Brian,

If you mean a Winforms TextBox, wouldn't it be eaiser to just set the
CharacterCasing property to CharacterCasing.Upper, so that all input
is automatically converted to upper case?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Nov 16 '05 #5

P: n/a
I tried that one before but was getting an error of

System.Web.UI.WebControls.TextBox does nto contain a definition for
CharacterCasing

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Brian

try this:

txtEventName.CharacterCasing=CharacterCasing.Upper ;

Note however, that only typed characters will be converted. If you do
something like txtEventName.Text="lowercase string"; contents of text box
will stay in lower case. I think it is small bug in TextBox control, anyway that's how it is.
HTH
Alex

"Brian Conway" <Br**********@qwest.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Okay here is the code that I came up with, but it doesn't change the
existing information in the text box on focus change.

string EventName;

EventName = txtEventName.Text;

EventName.ToUpper();

txtEventName.Text = EventName;

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
Brian,

If you mean a Winforms TextBox, wouldn't it be eaiser to just set the
CharacterCasing property to CharacterCasing.Upper, so that all input
is automatically converted to upper case?

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.



Nov 16 '05 #6

P: n/a
Assuming you have a textbox named TextBox1 you need to define the
Leave event for this text box, and then write the functionality for
that function:

this.TextBox1.Leave += new System.EventHandler(this.TextBox1_Leave);

private void TextBox1_Leave(object sender, System.EventArgs e)
{
this.TextBox1.Text=this.TextBox1.Text.ToUpper();
}

"Brian Conway" <Br**********@qwest.com> wrote in message news:<ey**************@TK2MSFTNGP10.phx.gbl>...
How do I convert a field that is filled in to uppercase within the C3 code?
I see the ToUpper in there, but how do I get the text box to convert this to
upper when you change focus or move to another text box?

Nov 16 '05 #7

P: n/a
Now it's clear - you did not specify that you use Web.UI control and
everybody assumed it was WinForms one.

Then you have to hook up some available event - like Validate - and use your
code there. Or maybe css style if browser supports it - see
Customizing the Appearance of ASP.NET Server Controls Using Styles on MSDN
or in .Net help file.

HTH
Alex

"Brian Conway" <Br**********@qwest.com> wrote in message
news:OG*************@TK2MSFTNGP11.phx.gbl...
I tried that one before but was getting an error of

System.Web.UI.WebControls.TextBox does nto contain a definition for
CharacterCasing

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Brian

try this:

txtEventName.CharacterCasing=CharacterCasing.Upper ;

Note however, that only typed characters will be converted. If you do
something like txtEventName.Text="lowercase string"; contents of text box will stay in lower case. I think it is small bug in TextBox control,

anyway
that's how it is.
HTH
Alex

"Brian Conway" <Br**********@qwest.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Okay here is the code that I came up with, but it doesn't change the
existing information in the text box on focus change.

string EventName;

EventName = txtEventName.Text;

EventName.ToUpper();

txtEventName.Text = EventName;

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uw**************@tk2msftngp13.phx.gbl...
> Brian,
>
> If you mean a Winforms TextBox, wouldn't it be eaiser to just set the > CharacterCasing property to CharacterCasing.Upper, so that all input
> is automatically converted to upper case?
>
>
>
> Mattias
>
> --
> Mattias Sjögren [MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.



Nov 16 '05 #8

P: n/a

"AlexS" <sa***********@SPAMsympaticoPLEASE.ca> wrote in message
news:uV**************@TK2MSFTNGP10.phx.gbl...
Now it's clear - you did not specify that you use Web.UI control and
everybody assumed it was WinForms one.

Then you have to hook up some available event - like Validate - and use your code there. Or maybe css style if browser supports it - see
Customizing the Appearance of ASP.NET Server Controls Using Styles on MSDN
or in .Net help file.

An even easier solution:
add the style attribute: text-transform: uppercase to the textbox

hth
andrew
Nov 16 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.