walter21 Posted April 28, 2003 Posted April 28, 2003 How can I do something like this, in VB.NET? Private Sub Text1_KeyPress(KeyAscii As Integer) KeyAscii = Asc(UCase(Chr(KeyAscii))) End Sub Thanks Quote
Moderators Robby Posted April 28, 2003 Moderators Posted April 28, 2003 Private Sub Text1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Text1.TextChanged Text1.Text = Text1.Text.ToUpper Text1.SelectionStart = Text1.Text.Length End Sub Quote Visit...Bassic Software
walter21 Posted April 28, 2003 Author Posted April 28, 2003 Thanks Robby. I think that is a good idea, but the problem is that the cursor is always at last position (Maybe I should use 'SelectionStart'), Also I can see some effect during asignation of upcase string when I try to type fast. Quote
Moderators Robby Posted April 28, 2003 Moderators Posted April 28, 2003 What do you mean "Maybe I should use 'SelectionStart' " ? Is that not what I posted? As for typing fast, I've held down a key which is probably 10 chars/second and they're all upper case. Quote Visit...Bassic Software
walter21 Posted April 28, 2003 Author Posted April 28, 2003 I used this, and it's work well Private Sub Text1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Text1.TextChanged Dim As Integer = Text1.SelectionStart Text1.Text = Text1.Text.ToUpper If >= 0 Then Text1.SelectionStart = End If End Sub Thank you for your help Robby :) P.D. I'm sorry, but my English is not very good Quote
*Gurus* divil Posted April 29, 2003 *Gurus* Posted April 29, 2003 Personally I would just set the CharacterCasing property to Upper :P Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.