Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

text box selection when execute form

Posted on 2002-03-06
5
Medium Priority
?
170 Views
Last Modified: 2010-05-02
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.


0
Comment
Question by:pak_slm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 1

Expert Comment

by:surajdeo
ID: 6846639
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
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 6846669
Private Sub Text1_Change()
    Text1.Text = UCase$(Text1.Text)
End Sub

Private Sub Text1_Click()
    SendKeys "{Home}+{End}"
End Sub
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6846672
Oops, Private Sub Text1_Click() should be: Private Sub Text1_GotFocus()
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6846872
Hi, Why "C" is graded?!
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6859522
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
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question