• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

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

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
fowlow
Asked:
fowlow
1 Solution
 
drichardsCommented:
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
 
fowlowAuthor Commented:
Great answer.
Worked nicely.

Tim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now