Because that would require touching and maintaining multiple controls on every data entry form. I suppose I could create my own control to do this and inherit it, but I'd rather do code KeyPress in the base form and get it for free in every form control.
Hard to make a case for .NET increasing developer productivity if that is required:) Must be a way around it. Thanks. -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of Shawn Wildermuth Sent: Tuesday, April 23, 2002 11:55 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET] KeyPress 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. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.