|
-
Feb 28th, 2005, 01:02 PM
#1
Thread Starter
Lively Member
A question in clipboard!
Hi...
I have a textbox and a command button..
and i want to paste the text from the clipboard to the text So:
Command1_click:
text1.seltext=clipboard.gettext
End sub
So when i click on the command button the content of the clipboard will paste into the text box
but here is the problem...I only want it to paste 1 time..you see if i exemple copy the word "HHHH" when i click on the command1 it will paste it over and over like that "HHHHHHHHHHHHHHHHHHHHHHHHHHH" but i just want it to paste it one time "HHHH" even if i kepp clicking on the command button..
....................................................................................................
I'm sure that you didn't understand a word cause i'm not that good with english
-
Feb 28th, 2005, 01:12 PM
#2
Re: A question in clipboard!
Then, right after the paste, do a Clipboard.Clear
That will clear everything currently stored in the clipboard.
If you don't want to do that, then you can encapsulate your paste code within an If statement to see if there is anything in the textbox already. If there is, then don't do the paste; if it is empty, do the paste.
-
Feb 28th, 2005, 01:20 PM
#3
Re: A question in clipboard!
Either clear the clipboard after you've pasted the text or have a check if the current clipboard text already have been pasted.
VB Code:
Private Sub Command1_Click()
Text1.SelText = Clipboard.GetText(vbCFText)
Clipboard.Clear
End Sub
VB Code:
Private Sub Command1_Click()
Static sLastText As String
Dim sTxt As String
sTxt = Clipboard.GetText(vbCFText)
If sTxt <> sLastText Then
Text1.SelText = sTxt
sLastText = sTxt
End If
End Sub
-
Feb 28th, 2005, 01:30 PM
#4
Thread Starter
Lively Member
Re: A question in clipboard!
 Originally Posted by Hack
Then, right after the paste, do a Clipboard.Clear
That will clear everything currently stored in the clipboard.
If you don't want to do that, then you can encapsulate your paste code within an If statement to see if there is anything in the textbox already. If there is, then don't do the paste; if it is empty, do the paste.
First...Thx for your help
But if i use the if statement to see if there is anything in the textbox already..
and if there is i don't do the paste and if there is do the paste..
but what if i paste something in the text and then i copy something else!!!!!
that way the text is not empty so it won't do the paste
-
Feb 28th, 2005, 01:44 PM
#5
Re: A question in clipboard!
 Originally Posted by Shady Soft
First...Thx for your help
But if i use the if statement to see if there is anything in the textbox already..
and if there is i don't do the paste and if there is do the paste..
but what if i paste something in the text and then i copy something else!!!!!
that way the text is not empty so it won't do the paste 
Ok, then if I'm reading you correctly, once you have it pasted in, you don't need it anymore, so just do the Clipboard.Clear and forget about the textbox check.
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
|