Monday, October 5, 2009

Tips and Tricks Visual Basic 6.0 Allow Only UpperCase Letters In TextBox


Tips and Tricks Visual Basic 6.0 Allow only uppercase in textbox.

'Add 1 TextBox To Your Form.
'Insert the following code to your form:

Private Sub Text1_Change()
old = Text1.SelStart
Text1.Text = UCase(Text1.Text)
Text1.SelStart = old
End Sub


or


Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

0 comments:

Your Ad Here