|
-
Mar 4th, 2002, 02:23 AM
#1
Thread Starter
Hyperactive Member
How to copy selected text
hi everybody
I am writing a function which will display the details of a keyword
which is selected from particular textbox by double clicking on the
text box.
My problem is, when i try to use the SelText property, it returns a
blank string. I have observed that when i double click on the text
box on particular word, it gets selected automatically but i can't
process that text in dblClick event of the text box(as i mentioned,
Seltext returns "").
How can i copy the selected text somewhere?
Please help!!
-
Mar 4th, 2002, 02:33 AM
#2
Is the 'selected' text user selected, or is it always fixed in the TextBox.
________
AROMED VAPORIZERS
Last edited by Bruce Fox; Aug 14th, 2011 at 04:54 AM.
-
Mar 4th, 2002, 02:39 AM
#3
Try:
VB Code:
Option Explicit
Dim sTemp As String
Private Sub Text1_LostFocus()
sTemp = Text1.SelText
End Sub
Private Sub Text2_DblClick()
Text2.Text = sTemp
End Sub
________
WildCATblond
Last edited by Bruce Fox; Aug 14th, 2011 at 04:54 AM.
-
Mar 4th, 2002, 02:59 AM
#4
Thread Starter
Hyperactive Member
Originally posted by Bruce Fox
Is the 'selected' text user selected, or is it always fixed in the TextBox.
No. Selected text is not the text selected by user. It is the text
which gets selected when user double clicks on any text.(Try it on
any text on this page.)
i want the word which gets selected by double clicking.
And it is not fixed also.
-
Mar 4th, 2002, 03:02 AM
#5
Thread Starter
Hyperactive Member
Originally posted by Bruce Fox
Try:
VB Code:
Option Explicit
Dim sTemp As String
Private Sub Text1_LostFocus()
sTemp = Text1.SelText
End Sub
Private Sub Text2_DblClick()
Text2.Text = sTemp
End Sub
No bruce Fox,
I dont want this.
i want it done while the focus is in the textbox only.
-
Mar 4th, 2002, 03:04 AM
#6
Hmmm, is there an API?
________
Silversurfer reviews
Last edited by Bruce Fox; Aug 14th, 2011 at 04:55 AM.
-
Mar 4th, 2002, 03:06 AM
#7
I think I may have... hang on
-
Mar 4th, 2002, 03:12 AM
#8
Fanatic Member
Use this:
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then me.Caption = Text1.SelText
End Sub
Leather Face is comin...
MCSD
-
Mar 4th, 2002, 03:26 AM
#9
Hyperactive Member
Is this what you wanted?
VB Code:
Private Sub Text1_DblClick()
lblText.Caption = Text1.SelText
End Sub
-
Mar 4th, 2002, 03:42 AM
#10
Thread Starter
Hyperactive Member
Originally posted by Harddisk
Is this what you wanted?
VB Code:
Private Sub Text1_DblClick()
lblText.Caption = Text1.SelText
End Sub
Yes this is what i want. And this works with normal textbox.
Unfortunately it seems that is doesn't work with Microsoft Forms 2.0 textbox
I am using it to display japanese characters
Thanks for the help!
-
Mar 4th, 2002, 03:52 AM
#11
I know this has the same effect as Text1.SelText, however,
in your case will this return the char string ur after?
VB Code:
Private Sub Text1_DblClick()
Dim sText As String
sText = Mid$(Text1.Text, Text1.SelStart, Text1.SelLength + 1)
MsgBox sText
End Sub
________
Housewives live
Last edited by Bruce Fox; Aug 14th, 2011 at 04:55 AM.
-
Mar 4th, 2002, 04:28 AM
#12
Thread Starter
Hyperactive Member
Hi Bruce Fox
In method you have suggested, i am getting SelLength = 0.
It seems that the text gets selected after double click.
-
Mar 4th, 2002, 04:30 AM
#13
Hmmmm,
Thats interesting, It works fine on a Form with aText1 for me.
I guess MSForms 2.0 may be different!
edit: - Just tested and your right.
MS Forms 2.0 TextBox1 won't work the same way 
Bruce.
________
01SmilyBlonde
Last edited by Bruce Fox; Aug 14th, 2011 at 04:55 AM.
-
Mar 4th, 2002, 04:30 AM
#14
Fanatic Member
That is why you should use the mouse up event..
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then me.Caption = Text1.SelText
End Sub
Leather Face is comin...
MCSD
-
Mar 4th, 2002, 04:36 AM
#15
Leather, did you test that in an MS Forms 2.0 TextBox1?
________
Washington Dispensaries
Last edited by Bruce Fox; Aug 14th, 2011 at 04:55 AM.
-
Mar 4th, 2002, 04:39 AM
#16
Sorry Leather,
It test out fine on a MS Forms 2.0 TextBox1 
________
LIVE SEX WEBSHOWS
Last edited by Bruce Fox; Aug 14th, 2011 at 04:56 AM.
-
Mar 4th, 2002, 04:41 AM
#17
Fanatic Member
No worries..
Leather Face is comin...
MCSD
-
Mar 4th, 2002, 04:44 AM
#18
Yeh, those bloody "MS Forms TextBox's" must 'fire' differently to
the good ol Text1.
Bruce.
________
XSexyKittenX
Last edited by Bruce Fox; Aug 14th, 2011 at 04:56 AM.
-
Mar 4th, 2002, 05:37 AM
#19
Thread Starter
Hyperactive Member
Hi Leather
Method you suggested fires 2 times for a double click.(MouseUp)
For MS Forms 2.0 textbox, text gets selected but I could not
display it using your method.
If you know 'Microsoft Bookshelf Basics' (it comes with Office 97),
it has this capability to display Japanese text and also display the details of selected word.
Well...let me know if you come up with something
Thanks for the help anyway.
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
|