Is it imperative that the textbox contains the escape characters? If it were
me, I'd show them on the form outside the textbox, like:

 

% <text box> ^

 

And then add them in code like:

 

string card = "%" + cardNumber.Text + "^";

 

That way, the user can see it like that but they only have to type the card
number not the delimiters.

 

Chris

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Rick
Sent: Friday, April 13, 2007 12:21 PM
To: [EMAIL PROTECTED]
Subject: SPAM-LOW: [AspNet2] Credit Card Swipe

 

Hello, I have a text box that has code in it that checks to make sure 
the first char is a '%' and the last is a '^' because that is how our 
CC's work. However, if I want someone to be able to type into it, 
they have to type a % first and the a carrot at the end. Is there 
anyway to avoid that...here is the code...I didn't write it, butit is 
how the boss wants it:

if (e.KeyChar == '^')
IsSwipeStarted = false;
if (IsSwipeStarted)
{
if (char.IsNumber(e.KeyChar) == false)
e.Handled = true;
}
else
e.Handled = true;
if (e.KeyChar == '%')
IsSwipeStarted = true;

if (e.KeyChar == '\r')
btnCardParse_Click(null, null);

TIA:

Rick

 



[Non-text portions of this message have been removed]

Reply via email to