Solved

text box selection when execute form

Posted on 2002-03-06
5
156 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 49

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 49

Expert Comment

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now