atesh Posted September 7, 2003 Posted September 7, 2003 what's the code at the keypress event that'll make a pressed lowercase letter uppercase. here is what tried, which obviously doesn't work but you get the idea: Private Sub TextBox_KeyPress(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox.KeyPress If e.KeyChar.IsLower(e.KeyChar) Then e.KeyChar = e.KeyChar.ToUpper(e.KeyChar) End Sub Quote To err is human, to really foul things up requires a computer.
wyrd Posted September 7, 2003 Posted September 7, 2003 Store the char in a seperate variable, then uppercase it. Quote Gamer extraordinaire. Programmer wannabe.
atesh Posted September 7, 2003 Author Posted September 7, 2003 here's what i did which works: If e.KeyChar.IsLower(e.KeyChar) Then e.Handled = True TextBox.Text &= e.KeyChar.ToUpper(e.KeyChar) SendKeys.Send("{END}") End If The pressing END key is so the caret is at the end of the textbox instead of the start. Quote To err is human, to really foul things up requires a computer.
Hughng Posted September 10, 2003 Posted September 10, 2003 You can also set the text box properties to upper case then all characters appear in the box will be upper. You don't have to manually convert them :-). Quote
*Experts* Volte Posted September 10, 2003 *Experts* Posted September 10, 2003 You shouldn't simply concatenate the key pressed, since the caret could be in the middle of the textbox. Set the CharacterCasing property to Upper, as that will handle pasting text as well. Quote
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.