Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INtercepting keystrokes

Status
Not open for further replies.

trebort

MIS
Jun 21, 1999
6
IE
I need to intercept keystrokes into a textbox and, if it is a lower case &quot;t&quot;, I need to make it an upper case &quot;T&quot;. For example my textbox would be typed:<br>
<br>
this is great <br>
<br>
but it should be displayed:<br>
<br>
This is greaT<br>
<br>
How do I do this?<br>
<br>
Thanks,<br>
<br>
Rob
 
if you are looking for just one letter<br>
try this<br>
<br>
Private Sub Text1_Change()<br>
If InStr(1, Text1.Text, &quot;t&quot;) Then<br>
a = Text1.Text<br>
Mid(a, InStr(1, Text1.Text, &quot;t&quot;), 1) = &quot;T&quot;<br>
Text1.Text = a<br>
End If<br>
<br>
End Sub<br>
<br>
It works but it needs to be moved to another event other than change<br>
paste it an you will see <br>
It will get you started though
 
Hi,<br>
<br>
Heres some code I used to intercept lower case vowels and change them into uppercase vowels.<br>
<br>
Private Sub txt1_KeyPress(KeyAscii As Integer)<br>
'txt1 was my textbox<br>
If KeyAscii = 105 Or KeyAscii = 101 Or KeyAscii = 97 Or KeyAscii = 117 Or KeyAscii = 111 Then<br>
KeyAscii = Asc(UCase$(Chr$(KeyAscii)))<br>
End If<br>
<br>
End Sub<br>
<br>
With some tinkering this should work with you. Remember to put it in the KeyPress event of the textbox, not the KeyDown.<br>
<br>
HTH<br>
<br>
C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top