Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get rid of error message

Status
Not open for further replies.

JimmyK

Programmer
Sep 8, 2000
142
VN
When i press a key at raed-only control, there is a error message say "The control is read-only".
How can i suppress this message?
Thanks Jimmy Le
nhan_tiags@yahoo.com
 
I, too, was annoyed by this, and here is how I fixed it.

Place this line in the control.keypress event:

NODEFAULT

While this control has the focus, the keyboard will not produce any effect whatsoever. Not quite what you wanted? Add this line above the NODEFAULT line:

if nKeyCode=9
return
endif

Now, if you press TAB, it will allow the key, any other key it will not. You can replace the number 9 with any other key code and even string them together with a bunch of 'OR's. For the list of key codes, look in the MSDN library for the INKEY() command.
 
Catch the key code in the keypress event and deal with it. For example call a UDF with a empty code.
 
Thanks CHPICKER,
That helps

Jimmy Le
nhan_tiags@yahoo.com
 
I too had this problem, and solved it with
using the VFP setting:

SET NOTIFY OFF

This will prevent you from receiving this message.

It could be possible that this setting is scoped to a datasession but you'll have to check that in the MSDN.

HTH,
Weedz (Wietze Veld)
veld4663@exact.nl
The Netherlands

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
Yes, Weedz, it do the job
Thanks
Jimmy Le
nhan_tiags@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top