Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Compare string used as a sentence

Posted on 2009-05-14
5
Medium Priority
?
305 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 375 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

Technology Partners: 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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

916 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