Click here to Skip to main content
15,889,808 members
Home / Discussions / C#
   

C#

 
QuestionValidating TextBox Pin
t4ure4n18-Jun-07 4:37
t4ure4n18-Jun-07 4:37 
AnswerRe: Validating TextBox Pin
Fatbuddha 118-Jun-07 4:57
Fatbuddha 118-Jun-07 4:57 
GeneralRe: Validating TextBox Pin
DavidNohejl18-Jun-07 5:06
DavidNohejl18-Jun-07 5:06 
GeneralRe: Validating TextBox Pin
Martin#18-Jun-07 5:10
Martin#18-Jun-07 5:10 
GeneralRe: Validating TextBox Pin
DavidNohejl18-Jun-07 5:14
DavidNohejl18-Jun-07 5:14 
GeneralRe: Validating TextBox Pin
Martin#18-Jun-07 5:22
Martin#18-Jun-07 5:22 
GeneralRe: Validating TextBox Pin
Fatbuddha 118-Jun-07 21:14
Fatbuddha 118-Jun-07 21:14 
AnswerRe: Validating TextBox Pin
lsconyer18-Jun-07 4:57
lsconyer18-Jun-07 4:57 
I hope this helps...

private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
try
{
int intValue = int.Parse(textBox1.Text);
}
catch (FormatException)
{
MessageBox.Show(textBox1.Text + " is not an integer");
}
}

private void textBox2_KeyUp(object sender, KeyEventArgs e)
{
try
{
decimal decValue = decimal.Parse(textBox2.Text);

string dec = decValue.ToString();

int i = dec.IndexOf(".");

if (dec.Length > (i + 1))
{
dec = dec.Substring(0, (i + 2));
throw new Exception("You value of " + textBox2.Text + " has too many numbers following the decimal point. You're new value is " + dec);
decValue = decimal.Parse(dec);
textBox2.Text = dec;
}
}
catch (FormatException)
{
MessageBox.Show(textBox1.Text + " is not an integer");
}
}





Lester
http://www.lestersconyers.com

AnswerRe: Validating TextBox Pin
DavidNohejl18-Jun-07 5:11
DavidNohejl18-Jun-07 5:11 
QuestionSimple code generation Pin
gantww18-Jun-07 4:03
gantww18-Jun-07 4:03 
AnswerRe: Simple code generation Pin
Giorgi Dalakishvili18-Jun-07 4:07
mentorGiorgi Dalakishvili18-Jun-07 4:07 
GeneralRe: Simple code generation Pin
gantww18-Jun-07 4:36
gantww18-Jun-07 4:36 
QuestionGraphics.DrawLines and Coordinate translation Pin
Jon Hulatt18-Jun-07 3:37
Jon Hulatt18-Jun-07 3:37 
AnswerRe: Graphics.DrawLines and Coordinate translation Pin
Luc Pattyn18-Jun-07 3:49
sitebuilderLuc Pattyn18-Jun-07 3:49 
GeneralRe: Graphics.DrawLines and Coordinate translation Pin
Jon Hulatt18-Jun-07 4:00
Jon Hulatt18-Jun-07 4:00 
QuestionVerfying Chain Verification Process Pin
suprajav18-Jun-07 3:29
suprajav18-Jun-07 3:29 
QuestionSharePoint Development Pin
alexfromto18-Jun-07 3:09
alexfromto18-Jun-07 3:09 
QuestionMovable Selection Box Pin
R.Myers18-Jun-07 2:54
R.Myers18-Jun-07 2:54 
AnswerRe: Movable Selection Box Pin
Chintan.Desai18-Jun-07 3:22
Chintan.Desai18-Jun-07 3:22 
GeneralRe: Movable Selection Box Pin
R.Myers18-Jun-07 7:35
R.Myers18-Jun-07 7:35 
QuestionListView control and key strokes Pin
zaboboa18-Jun-07 2:15
zaboboa18-Jun-07 2:15 
AnswerRe: ListView control and key strokes Pin
RepliCrux18-Jun-07 2:32
RepliCrux18-Jun-07 2:32 
GeneralRe: ListView control and key strokes Pin
zaboboa18-Jun-07 2:35
zaboboa18-Jun-07 2:35 
Questionaccess denied in case of share folder Pin
devesh_code18-Jun-07 2:08
devesh_code18-Jun-07 2:08 
AnswerRe: access denied in case of share folder Pin
RepliCrux18-Jun-07 2:28
RepliCrux18-Jun-07 2:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.