Upcase'ing textbox input

  • Thread starter Thread starter Wapiti
  • Start date Start date
W

Wapiti

What is the best way to upcase text box input?
I'm currently using the textchanged event as below - but there must be a
better way - especially since I have to do this for each text box on the
form. Could do it in code, on the database - but that could tick a user
off if they think they are entering something in Proper case, and the
backend changes it to all upcase without them knowing it. I'd like them to
'see' all caps getting entered into the system - and the system requiring
it. Is there a better way?
Private Sub txtIssueEmpl_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles txtIssueEmpl.TextChanged

Me.txtIssueEmpl.Text = UCase(Me.txtIssueEmpl.Text)

End Sub
 
Thanks - but where does one get the TextboxEx control??

And, this may be off topic, but is there any way to convert all textbox
controls to this textboxex control easily? That is, without deleting the
textboxes on each form and replacing them with textboxex controls? Anyway
by editing the forms' class code; ie cut/paste with possibly other editing?

thx
 
Since the TextBoxEx is a superset of the TextBox functionality you can
simply replace the definition in code and the designer will change to
reflect this.
First add a reference to OpenNETCF.Windows.Forms to your project after
installing the SDF.
Close down any designer views in your project.
Open the form in code view.
In your form code replace all instances of "System.Windows.Forms.TextBox"
with "OpenNETCF.Windows.Forms.TextBoxEx" e.g.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
becomes
Friend WithEvents TextBox1 As OpenNETCF.Windows.Forms.TextBoxEx

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Perfect!!! Thanks Peter. I'll give it a shot.


Peter Foot said:
Since the TextBoxEx is a superset of the TextBox functionality you can
simply replace the definition in code and the designer will change to
reflect this.
First add a reference to OpenNETCF.Windows.Forms to your project after
installing the SDF.
Close down any designer views in your project.
Open the form in code view.
In your form code replace all instances of "System.Windows.Forms.TextBox"
with "OpenNETCF.Windows.Forms.TextBoxEx" e.g.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
becomes
Friend WithEvents TextBox1 As OpenNETCF.Windows.Forms.TextBoxEx

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Hmm, I guess it wasn't as easy as I had thought...

I did as you said, and am getting a bunch of build errors when trying to
display the form editor/designer - and when bringing up the code window. I
have an "Imports OpenNetCF.Windows.Forms" in my form - and tried to use Add
References. Still happening????

Example errors are as follows:
C:\Documents and Settings\All Users\Documents\Visual Studio
Projects\pdaBarcodeInterface\frmMain.vb(904): The variable 'txtDefEmployee'
is either undeclared or was never assigned.

Could not find type 'OpenNETCF.Windows.Forms.TextBoxEx'. Please make sure
that the assembly that contains this type is referenced. If this type is a
part of your development project, make sure that the project has been
successfully built.

C:\Documents and Settings\All Users\Documents\Visual Studio
Projects\pdaBarcodeInterface\frmMain.vb(898): The variable 'txtDefStockarea'
is either undeclared or was never assigned.

Could not find type 'OpenNETCF.Windows.Forms.TextBoxEx'. Please make sure
that the assembly that contains this type is referenced. If this type is a
part of your development project, make sure that the project has been
successfully built.
 
I have noticed that its happening anywhere I'm assigning the textboxex to a
tab in the default tab control from windows:

ie
Me.tpgAbout.Controls.Add(Me.txtIssueName)

Could this be the issue? Is there a way to fix this?

Thanks,

Mike
 
Back
Top