Solved

Compare string used as a sentence

Posted on 2009-05-14
5
289 Views
Last Modified: 2012-05-07
The following Code will not except a string with spaces in them, Also it will not work if the first letter is a sash "\" example

\OFFICE 67
\DIRECT

I'm scanning this data into a scanner program I developed using C# it blowes up when it hit a space or a "/"


if (!Char.IsLetterOrDigit(e.KeyChar) && e.KeyChar != '\b')

{
 
 

}

Open in new window

0
Comment
Question by:daruffin
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
AndreSteffens earned 125 total points
ID: 24386440
Hi,
What exception message do you get?
Where is the 'e'  variable coming from?
0
 

Author Comment

by:daruffin
ID: 24387871
I'm developing in Windows CE

private void txtbox_KeyPress_Number(object sender, KeyPressEventArgs e)
0
 
LVL 4

Expert Comment

by:AndreSteffens
ID: 24388183
When I call the method below with ReadChar(new KeyPressEventArgs('/') I get no exception.
So are you sure your code "blows" up where you think it does?
What exception message do you get?
 public void ReadChar(KeyPressEventArgs e)

        {

            if (!Char.IsLetterOrDigit(e.KeyChar) && e.KeyChar != '\b')

            {

                
 

            }
 

        }

Open in new window

0
 

Author Comment

by:daruffin
ID: 24389748
I will review it and get back to you tomorrow.
0
 

Author Comment

by:daruffin
ID: 24423471
Sorry for the delay I have been on Vacation.

The problem is when I scan /INSTALL the first char is changed to ")" meaning when it finishes I have something like this

)NSTALL

 it takes the I out and changes the "/" to this ")"

Also it does not work for *INSTALL when I scan it.

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now