|
-
Oct 20th, 2001, 10:15 AM
#1
Thread Starter
New Member
Select ALL code
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
-
Oct 20th, 2001, 10:20 AM
#2
Member
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
-
Oct 20th, 2001, 10:28 AM
#3
Thread Starter
New Member
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.
-
Oct 20th, 2001, 10:37 AM
#4
PowerPoster
You can select text in a control, such as a textbox
VB 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
mnuSelectAll is a menu item build with VB's Menu Editor
-
Oct 20th, 2001, 10:37 AM
#5
Member
Try this
TextBox.SelStart = 0
TextBox.SelLength = Length(TextBox.Text)
-
Oct 20th, 2001, 10:38 AM
#6
Member
bah, he beat me to it :P how do you do that fancy VB Code quoting though?
-
Oct 20th, 2001, 10:40 AM
#7
PowerPoster
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.
-
Oct 20th, 2001, 10:41 AM
#8
Member
picky picky picky
-
Oct 20th, 2001, 10:42 AM
#9
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
-
Oct 20th, 2001, 10:44 AM
#10
PowerPoster
-
Oct 20th, 2001, 11:29 AM
#11
Thread Starter
New Member
Thanks guys, peace for all. ha...
-
Oct 20th, 2001, 03:35 PM
#12
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.
-
Oct 20th, 2001, 03:39 PM
#13
PowerPoster
okay, apologies all-round, but there was 5 minutes between my first and yours
-
Oct 20th, 2001, 03:43 PM
#14
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|