|
-
Jul 2nd, 2002, 12:31 AM
#1
Thread Starter
Hyperactive Member
Can't prevent from copy(Forms2.0)**( Resolved)**
Hi all,
I'm using is forms2.0 text box. And i want to disable the user from copying the text from it..So I used the following code. But this is not working with forms 2.0 text box.
-----------------------------------------------------------------------------------
If KeyAscii = 3 Or KeyAscii = 22 Then KeyAscii = 0
'keyascii=3 : Ctrl +c
'keyascii=22 : ctrl + v
Clipboard.Clear
-----------------------------------------------------------------------------------
So what can i use here? Help me,
Anita
Last edited by anita2002; Jul 2nd, 2002 at 06:40 AM.
Can't imagine life without VB
(Various Boyfriends)
-
Jul 2nd, 2002, 12:35 AM
#2
well first of all it's not a good thing to clear the clipboard 
second, why not just make a LABEL control?
also, you need to account for 2 keys for the copy thingie
Copy: control + insert and control + c
umm why do you want to disable ctrl + V?
another thing -> even if the keys are disabled the user can right click with the mouse to copy some text. I dont know but there might be some API to disable this....
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 2nd, 2002, 12:38 AM
#3
The lycnonix is getting to u Polite. 
Try this
-
Jul 2nd, 2002, 12:45 AM
#4
as MrPolite suggested it not good to clear clipboard ...
but still if u wanna do it on mouse.
clipboard.clear
-
Jul 2nd, 2002, 01:07 AM
#5
Thread Starter
Hyperactive Member
Thank you Mr Polite, Mendhak, and Khalik..
But here as I have locked my textbox, automatically the mouse events won't work here. So i don't worry about copying something with mouse..So u'r thread didn't help me Mendhak..
Now the only issue is how to disable ctrl + c and ctrl +v
If it is the normal text box the the code which i have given should work. But sinces its a Froms2.0 text box, my code is not working. So please tell me what to do?
And why it is not good to clear the clipboard?
Please help.
Anita
Can't imagine life without VB
(Various Boyfriends)
-
Jul 2nd, 2002, 01:24 AM
#6
Originally posted by mendhak
The lycnonix is getting to u Polite. 
Try this
it been long time... Mendhak..
how about combo box....
-
Jul 2nd, 2002, 01:29 AM
#7
The picture isn't missing
if you want to show data like a textbox then just make a label with borderstyle to 1, backcolor to white, then use it like a textbox to show text. it will look similar to a textbox in almost all ways.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 2nd, 2002, 01:31 AM
#8
Originally posted by anita2002
Thank you Mr Polite, Mendhak, and Khalik..
But here as I have locked my textbox, automatically the mouse events won't work here. So i don't worry about copying something with mouse..So u'r thread didn't help me Mendhak..
Now the only issue is how to disable ctrl + c and ctrl +v
If it is the normal text box the the code which i have given should work. But sinces its a Froms2.0 text box, my code is not working. So please tell me what to do?
And why it is not good to clear the clipboard?
Please help.
Anita
well the user might have some data on the clipboard and they dont want to clear it eveytime they use your app
I still dont know why you want to disable ctrl +v. you said it is locked, and ctrl + v is for pasting, you dont need to worry about that. You just need to take care of copying (shortcuts: ctrl + C and ctrl + instert)
this is how you would detect it:
VB Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = vbCtrlMask And (KeyCode = vbKeyC Or KeyCode = vbKeyInsert) Then
' Disable it here if you can :D
End If
End Sub
dunno how to disable it, I tried KeyCode = 0, but that didnt work
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Jul 2nd, 2002, 03:45 AM
#9
Thread Starter
Hyperactive Member
Originally posted by MrPolite
well the user might have some data on the clipboard and they dont want to clear it eveytime they use your app
I still dont know why you want to disable ctrl +v. you said it is locked, and ctrl + v is for pasting, you dont need to worry about that. You just need to take care of copying (shortcuts: ctrl + C and ctrl + instert)
this is how you would detect it:
VB Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = vbCtrlMask And (KeyCode = vbKeyC Or KeyCode = vbKeyInsert) Then
' Disable it here if you can :D
End If
End Sub
dunno how to disable it, I tried KeyCode = 0, but that didnt work
Hi,
Mr. Polite. Thanks for u'r code..
But the problem is i think here the user presses the "ctrl" and "c" keys simultaneously. How to trace this?
If nyone able to trace this event then i think it will do with the help of clipboard.clear
well..i simply added clipbroard.clear in u'r code before the end if statement. So it is working for only "ctrl" key or only "c" key. But not working when the press the "ctrl" and "c" keys simultaneously.
Please elp me
Anita
Can't imagine life without VB
(Various Boyfriends)
-
Jul 2nd, 2002, 06:16 AM
#10
Thread Starter
Hyperactive Member
Hi all,
Can anyone help me???
Does anyone have some solution?
Help.....
Anita
Can't imagine life without VB
(Various Boyfriends)
-
Jul 2nd, 2002, 06:19 AM
#11
Originally posted by anita2002
Hi all,
Can anyone help me???
Does anyone have some solution?
Help.....
Anita
not abetter one...
onlost focus clear the clipboard....
by the way pasting may be a problem .. copy may not be a problem to ur app.... if u are able sto[ pasting it ok... think soo
-
Jul 2nd, 2002, 06:38 AM
#12
Thread Starter
Hyperactive Member
Originally posted by khalik
not abetter one...
onlost focus clear the clipboard....
by the way pasting may be a problem .. copy may not be a problem to ur app.... if u are able sto[ pasting it ok... think soo
Thanks Khalik,
But unfortunately clipboard.clear didn't worked on lost focus also. Finally i use clipboard.clear on mousemove event. It worked... Though not a good way..
Anita..
Can't imagine life without VB
(Various Boyfriends)
-
Jul 2nd, 2002, 02:18 PM
#13
Hi again 
The code that I gave you works for Ctrl + C and Ctrl + Instert. The problem was that the data gets copied to the clipboard AFTER you exit the KeyDown sub, so you had to put a DoEvents there. Try this, I tested it and it works 
VB Code:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = vbCtrlMask And (KeyCode = vbKeyC Or KeyCode = vbKeyInsert) Then
' I think when you use DoEvents, it will copy to clipboard
DoEvents
' Now clear the clipboard
Clipboard.Clear
End If
End Sub
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
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
|