Hi,
I am new in the vb word, and I am trying to add a [Select All](ctl-A) menu selection under the Edit option. Does anyone wrote code for this.
If you had, could you shared with me. Thanks
Printable View
Hi,
I am new in the vb word, and I am trying to add a [Select All](ctl-A) menu selection under the Edit option. Does anyone wrote code for this.
If you had, could you shared with me. Thanks
select all what?
other than that go to Menu Editor (right click on your form) then under Edit hit Insert (make sure it's in the right alignment) then just put in Select &All for the caption and mnuEditSelAll for the name and choose your shortcut from the list. then just click on Edit and Select All in your form and it'll take you to the onClick event and you can put in your code to do whatever
Thanks shabbs, but I did all you said, what I need is the code that goes under the click event to select all the text on the form, like the select all in any windows screen.
You can select text in a control, such as a textbox
mnuSelectAll is a menu item build with VB's Menu EditorVB Code:
Private Sub mnuSelectAll_Click() If TypeOf Screen.ActiveControl Is TextBox Then Screen.ActiveControl.SelStart = 0 Screen.ActiveControl.SelLength = Len(Screen.ActiveControl.Text) End If End Sub
Try this
TextBox.SelStart = 0
TextBox.SelLength = Length(TextBox.Text)
bah, he beat me to it :P how do you do that fancy VB Code quoting though?
by putting it in code tags;
[vbcode]
Dim i As Long
' blah blah blah
[/vbcode]
produces
VB Code:
Dim i As Long ' blah blah blah
Incidently, it's Len, not Length and you should use ActiveControl rather than specifying one if it could be any control.
picky picky picky :p
He told you how to do it peree1, just didn't give you the code.
VB Code:
Private Sub mnuSelectAll_Click() With Text1 .SelLength = 0 .SelStart = Len(.Text) .SetFocus End With End Sub
Matt, I think we've got the idea :rolleyes:
And don't specify the control!! :p :)
Thanks guys, peace for all. ha...
Quote:
Originally posted by chrisjk
Matt, I think we've got the idea :rolleyes:
And don't specify the control!! :p :)
You may have the idea, but at the time when I posted a reply, there were no replies other than peree1's second post in this thread.
okay, apologies all-round, but there was 5 minutes between my first and yours
Quote:
Originally posted by chrisjk
okay, apologies all-round, but there was 5 minutes between my first and yours
I open about 5-10 threads at a time, click reply to the ones I know, answer them all, and by the time I get back to the one, like this one, it's already been answered, sorry about that, just many more people on the boards now than there was 1 year ago.