Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is there an easy way to enable the Ctrl-A key to work in a VB.NET text box?

Posted on 2004-08-15
2
Medium Priority
?
215 Views
Last Modified: 2008-02-01
I want to be able to select all text within a text box in VB.NET.  CTRL-A does not work by default. Is there a simple way to enable it?
0
Comment
Question by:fowlow
2 Comments
 
LVL 19

Accepted Solution

by:
drichards earned 500 total points
ID: 11807298
You can add this to your form (don't know if there's an easier way):

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If (e.KeyChar = Microsoft.VisualBasic.Chr(1)) Then
            TextBox1.SelectAll()
            e.Handled = True
        End If
    End Sub
0
 

Author Comment

by:fowlow
ID: 11810045
Great answer.
Worked nicely.

Tim
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses

810 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