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
205 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 125 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …

792 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