|
-
Sep 9th, 2000, 03:32 PM
#1
Thread Starter
Frenzied Member
I need to copy the whole text box and then make it pasteble in VB or an email, or what ever. I tried this:
Clipboard.SetText Text2.SelText
but it doesn't work
NXSupport - Your one-stop source for computer help
-
Sep 9th, 2000, 03:52 PM
#2
_______
<?>
'copy and paste text1 to text 2
'
Code:
On Error Resume Next ' Set up error handling.
Clipboard.Clear ' Clear Clipboard.
Clipboard.SetText Text1.Text ' Put text on Clipboard.
Text2.Text = Clipboard.GetText(vbCFText) ' Get Clipboard text.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 9th, 2000, 03:54 PM
#3
Thread Starter
Frenzied Member
that worked but I can't get it to goto like email programs
NXSupport - Your one-stop source for computer help
-
Sep 9th, 2000, 03:56 PM
#4
_______
<?>
haven't played with email programs.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Sep 9th, 2000, 04:03 PM
#5
Frenzied Member
You can use
Code:
SendMessage Text1.hwnd, WM_CUT, True, 0&
-
Sep 9th, 2000, 04:10 PM
#6
Thread Starter
Frenzied Member
it says that send message is not defined
NXSupport - Your one-stop source for computer help
-
Sep 9th, 2000, 04:16 PM
#7
Frenzied Member
Well declare it first in a module
Copy this or use the api viewer
This should be written in one row
Code:
Public Declare Function SendMessage Lib "user32"
Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
-
Sep 9th, 2000, 04:22 PM
#8
Thread Starter
Frenzied Member
that still doesn't work for me
NXSupport - Your one-stop source for computer help
-
Sep 9th, 2000, 04:42 PM
#9
dimava, take a look at this thread.
-
Sep 9th, 2000, 05:40 PM
#10
Thread Starter
Frenzied Member
I did, and that thing didn't work
NXSupport - Your one-stop source for computer help
-
Sep 9th, 2000, 07:32 PM
#11
HeSaidJoe's code works like a charm!
Code:
Private Sub Command1_Click()
Clipboard.Clear
Clipboard.SetText Text1.SelText
End Sub
I have MS Outlook Express And MS Outlook, I can paste into Both of them.....
-
Sep 9th, 2000, 07:36 PM
#12
Thread Starter
Frenzied Member
I tried putting it into aol mail, it doesn't work, I tried putting it into vb it didn't work, I even Tried putting it in this vb forum and it still didn't work
NXSupport - Your one-stop source for computer help
-
Sep 9th, 2000, 07:43 PM
#13
ext1
hmmmm works for me,
I selected "ext1" from a text box in VB, and I just pasted, it works....
-
Sep 9th, 2000, 07:51 PM
#14
Thread Starter
Frenzied Member
ok, I see my mistake, you hae just pointed it out to me. I need to select it first then click copy... but how do I get my program to select the whole text?
NXSupport - Your one-stop source for computer help
-
Sep 9th, 2000, 08:07 PM
#15
Code:
Private Sub Command1_Click()
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
Clipboard.Clear
Clipboard.SetText Text1.SelText
End Sub
-
Sep 9th, 2000, 08:25 PM
#16
Actually, almost same code that Dennis gave was in that thread I gave dimava.
Code:
Clipboard.Clear
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Clipboard.SetText Text1.SelText
-
Sep 9th, 2000, 08:34 PM
#17
Thread Starter
Frenzied Member
THANKS FOR EVERYONE WHO STAYED WITH ME UNTIL I GOT MY PROBLEM. Sometimes there are things right in front of you and you dont see them (no, I dont ware glasses)
NXSupport - Your one-stop source for computer help
-
Sep 10th, 2000, 04:58 AM
#18
Conquistador
you don't actually have to select it, to copy it:
Code:
Clipboard.Clear
Clipboard.SetText Text1
This sends the entire contents of text1 to the clipboard
-
Sep 10th, 2000, 11:33 AM
#19
da_silvy, as Megatron says, it's slower. Look at this thread.
-
Sep 10th, 2000, 09:28 PM
#20
Conquistador
no, he wasn't
if you read it carefully, Megatron was saying that selecting all the text, then copying it was twice as slow, and he was suggesting that his method (like mine) was faster
also, Dimava was not suggesting that he/she was using it as a menu control for Copy.
-
Sep 10th, 2000, 09:40 PM
#21
No, I'll show you:
Matthew Gates
Fanatic Member
Registered: Apr 2000
Posts: 1537
Code:
Clipboard.SetText Text1.text
__________________
Matthew Gates
Email: [email protected]
ICQ: 73685536
Visual Basic 4.0 Professional Edition
Visual Basic 6.0 SP4 Professional Edition
Megatron
Guru
Registered: Mar 1999
Posts: 3203
Most programs allow you to copy the selected the Text. for this reason, you should use SelText instead.
Code:
Clipboard.SetText Text1.SelText
__________________
Megatron
[email protected]
Visual Basic 5 SP3
See the VBFE Library
Matthew Gates
Fanatic Member
Registered: Apr 2000
Posts: 1537
Megatron, Crazy VIII said he wanted to copy a textbox to the clipboard, not the selected text.
__________________
Matthew Gates
Email: [email protected]
ICQ: 73685536
Visual Basic 4.0 Professional Edition
Visual Basic 6.0 SP4 Professional Edition
Megatron
Guru
Registered: Mar 1999
Posts: 3203
Using SelText will copy the seleted text (if any), however, if no text is selected, then this will copy the whole text.
Code:
If Text1.SelText = "" Then
Clipboard.SetText Text1
Else
Clipboard.SetText Text1.SelText
End If
[Edited by Megatron on 09-09-2000 at 01:18 PM]
__________________
Megatron
[email protected]
Visual Basic 5 SP3
See the VBFE Library
Matthew Gates
Fanatic Member
Registered: Apr 2000
Posts: 1537
I know that. But he wants the whole textbox copied.
Have it your way.
Code:
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Clipboard.SetText Text1.SelText
My way's shorter though.
Megatron
Guru
Registered: Mar 1999
Posts: 3203
But almost twice as slow.
__________________
Megatron
[email protected]
Visual Basic 5 SP3
See the VBFE Library
The bold line, "My way's shorter though." is referring to the very top post.
Code:
Clipboard.SetText Text1.text
Which is the same way as your code. And Megatron says that it's slow. Understand?
-
Sep 10th, 2000, 09:47 PM
#22
Conquistador
not really, but i don't care
don't worry!
-
Sep 10th, 2000, 09:52 PM
#23
Yeah, maybe Megatron's wrong .
Oh well, as long as it works, it's good.
This thread is settled.
-
Sep 10th, 2000, 10:04 PM
#24
Thread Starter
Frenzied Member
thanks to everyone and...
da_silvy
if you were refering to me as he/she, I'm male
NXSupport - Your one-stop source for computer help
-
Sep 10th, 2000, 11:48 PM
#25
Conquistador
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
|