Solved

text box selection when execute form

Posted on 2002-03-06
5
161 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
  • 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 51

Accepted Solution

by:
Ryan Chong earned 50 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 51

Expert Comment

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

679 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