How to select all in textbox?

B

Brett

I have a textbox with width of 504 and height 248. It gets filled with much
content so there is a vertical scroll bar present. When I click into this
box and do Ctrl + A, it should highlight everything. However, nothing
happens. I have to click into the box, hold down Shift and page down to get
everything. Is there a way to enable the select all option?

Thanks,
Brett
 
L

Larry Lard

Brett said:
I have a textbox with width of 504 and height 248. It gets filled with much
content so there is a vertical scroll bar present. When I click into this
box and do Ctrl + A, it should highlight everything. However, nothing
happens. I have to click into the box, hold down Shift and page down to get
everything. Is there a way to enable the select all option?

Interesting. A plain textbox DOES respond to Ctrl-Z X C V (with the
usual Windows meanings), so those must be 'built-in' to the TextBox
control. But I suppose Ctrl-A is not 'Windows standard' enough to make
it.

To provide this functionality for a TextBox named txt :

Private Sub txt_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles txt.KeyDown
If e.Control And e.KeyCode = Keys.A Then
txt.SelectAll()
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top