Anyone knows how can I prevent users from entering data from keyboard? I mean I need to disable the keyboard for a while on my application and then activate it again and I don't know how to do this, i guess there is a function for this, but I don't know wich...
hello sayan,
this is srusti here. well you can do it but partially. you can prevent the user from affecting the contents but still the tabs and escapes will be working.
try out this
form's keypreview=true -> this will take all keys of the controls to be handled by the form
in the keypress event write
keyascii=0 -> this will nullify the key
Sayan,
Do you need to disable the keypresses for just your application, or do you need to disable keypresses for all applications running on the PC? If it is just for your application, then the method put forth by srusti should work fine . . . if it is for all applications on the PC . . . well, it can still be done, but it gets a litle more complicated. Let me know which one you are trying to do. - Jeff Marler B-)
hey! Thanks for your reply but, this doesn't seem to be working at all...
Here is exactly what I need to do:
I'm building an app where at some time I need to edit an ms Word OLE object by code only! But when I open it for editing if the user presses any key (between the time that goes between opening and writing to it by code) he will write on the OLE object and I need to prevent this. So what I need to do is to lock the keyboard input just after I've opened the OLE object for editing and then unlock it after the program has writen to the object...
I tryed the method you told me on a form with just a text box but, it's not working since I still can write on the text box and also I'm not sure if that will fit to what I want...
Anyway if you could give me a hand on this I'd really appreciate it because I'm really not finding solutions for this...
PS: As you've figured I don't need to lock the keyboard for all the apps running on my PC, but I think I remember seen such a question answered in one of this forums, I'm not sure if it was on this one though.
ermmm... Actually it's working(I was doing something wrong :|), but I'll have to try and adapt it to what I need. If you have any good ideas on how to accomplish this they would be appreciate but, I'll start checking this out now.
Thanks again
ermmm... srusti, actually your method it's working(I was doing something wrong :|), but I'll have to try and adapt it to what I need. If you have any good ideas on how to accomplish this they would be appreciate but, I'll start checking this out now.
Thanks again
ermmm... srusti, actually your method is working(I was doing something wrong :|), but I'll have to try and adapt it to what I need. If you have any good ideas on how to accomplish this they would be appreciate but, I'll start checking this out now.
Thanks again
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.