[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Special characters should not be allowed in single line edit control

Posted on 2007-03-29
1
Medium Priority
?
446 Views
Last Modified: 2013-12-26
I have a single line edit control in my window. The requirement is user should not be allowed to enter special characters in that single line edit. That means only it should accept alpha numeric characters.

Can any one give generic code for this?

Thanks
Srinib
0
Comment
Question by:srinib
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 14

Accepted Solution

by:
sandeep_patel earned 200 total points
ID: 18821832
hi,

create a global or local funtion with name uf_isalphanum(string as_string) returns boolean

///script
long ll_count=0
long ll_length
char lc_char[]
integer      li_ascii
boolean lb_null

If IsNull(as_string) Then
      SetNull(lb_null)
      Return lb_null
End If

ll_length = Len (as_string)

If ll_length=0 Then
      Return False
End If

lc_char = as_string

do while ll_count<ll_length
      ll_count ++
      li_ascii = Asc (lc_char[ll_count])
      
      // '0'= 48, '9'=57, 'A'=65, 'Z'=90, 'a'=97, 'z'=122
      If li_ascii<48 or (li_ascii>57 and li_ascii<65) or &
            (li_ascii>90 and li_ascii<97) or li_ascii>122 then
            Return False
      end if
loop

return True

now you can call this function anywhere... and check return value

Regards,
Sandeep
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question