Solved

Special characters should not be allowed in single line edit control

Posted on 2007-03-29
1
443 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 50 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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: …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

688 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