Why not just set the CharacterCasing property of your TextBox's?  You
can set it in the Property window or with code:

textBox1.CharacterCasing = CharacterCasing.Upper

Thanks,

Shawn Wildermuth
[EMAIL PROTECTED]

> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]]
> On Behalf Of Dan Souk
> Sent: Wednesday, April 24, 2002 12:27 AM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] KeyPress
>
>
> I need to ensure that all characters are forced to upper case
> for nearly all data entry forms in a VB.NET app. Thought I'd
> try to do it via the KeyPress event, but since arguments are
> passed by value, not reference, I'm stuck.
>
> In VB6, the ASCII keycode is passed by ref as an integer, and
> it was easy to ensure upper case via the following code:
>
> Sub KeytoUCase(intKey As Integer)
>   Dim strChar As String
>   strChar = Chr(intKey)
>   intKey = Asc(UCase(strChar))
> End
>
> VB.NET's event signature is this:
>
> Private Sub frm_KeyPress(ByVal sender As Object, ByVal e As
> System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
>   e.Handled = True
>   'READ ONLY!!
>   'e.KeyChar = basGUIUtils.KeytoUCase(AscW(e.KeyChar))
> End Sub
>
> Any thoughts on how to do this, without having to touch every
> individual control?
>
> ------------------------
> Dan Souk
> Finna Technologies, Inc.
> 2410 Lindsay Ct
> West Chicago, IL 60185
> +1-630-762-8257 phone
> +1-630-762-8258 fax
> http://www.finnatech.com
>
> You can read messages from the DOTNET archive, unsubscribe
> from DOTNET, or subscribe to other DevelopMentor lists at
> http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to