Link to home
Start Free TrialLog in
Avatar of pak_slm
pak_slm

asked on

text box selection when execute form

1. i design a form so i want that when text box got focus previously displayed values should be selected.

if i want to change the value simply i press delete key from the keyboard and enter new value.
2.
what is the way when i input value in text box it convert in caps whenever caps lock key is off.


Avatar of surajdeo
surajdeo
Flag of Mexico image

Hi,

 1. On gotfocus for selecting text write following code.


 Private Sub Text1_GotFocus()

    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
   
 End Sub


2. For caps

Private Sub Text1_KeyPress(KeyAscii As Integer)

    If KeyAscii >= 97 And KeyAscii <= 122 Then KeyAscii = KeyAscii - 32
   
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oops, Private Sub Text1_Click() should be: Private Sub Text1_GotFocus()
Hi, Why "C" is graded?!
Avatar of Netminder
Netminder

Grade changed; comment (as corrected) is accurate, simple and works.

pak_slm,

A simple answer is usually the best answer. Please do not grade based on the number of characters typed into a response, but rather on whether or not you understand it and use it.

Netminder
Community Support Moderator
Experts Exchange