•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 374,572 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,848 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser:
Checking whether value is entered into a control and preventing focus to go out if no value is entered.
private void txtName_Validating(object sender, CancelEventArgs e) { if (txtName.Text == "") { errorProvider1.SetError(txtName, "Name cannot be blank"); e.Cancel = true; } else errorProvider1.SetError(txtName, ""); }
Comments (Newest First)
bruceraymond | Newbie Poster | Jun 15th, 2008
•
•
•
•
C# has internal parsing routines that also work nicely.
Cheers,
Bruce
Cheers,
Bruce
double x; bool valid = double.TryParse( initialValue.Text, out x );
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)