Preventing certain characters from being input

In this category you can exchange your programming questions and solutions.
Post Reply
Darren
Posts: 63
Joined: Wed May 11, 2011 11:55 am

Preventing certain characters from being input

Post: # 727Post Darren
Fri Jun 17, 2011 11:43 am

Can any body tell me how I can Preventcertain characters from being input into an edit box. For example, I do not want the ?, ?, $, % or & characters to be placed into an edit box. How can I do this???

Many thanks in advance!!!

Darren

Marco
Site Admin
Posts: 246
Joined: Sat Sep 15, 2018 8:41 pm

Preventing certain characters from being input

Post: # 728Post Marco
Sat Jun 18, 2011 3:47 pm

this will help I guess:


`prevent characters whithin an edit
object myform as form
  object myedit as edit
    onkeypress=myedit_keypress
  end object
  showmodal
end object

sub myedit_keypress(key as byte)
   if instr("!@#$%^&*()",chr$(key))>0 then key=0
end sub

Post Reply