| | |
Windows Forms Input Validation with Validating Event and ErrorProvier Control
Please support our C# advertiser: Intel Parallel Studio Home
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, ""); }
0
•
•
•
•
C# has internal parsing routines that also work nicely.
Cheers,
Bruce
Cheers,
Bruce
C# Syntax (Toggle Plain Text)
double x; bool valid = double.TryParse( initialValue.Text, out x );
Similar Threads
- deploy unsigned windows forms control (activex) for intranet use (ASP.NET)
- validating event procedure (VB.NET)
- Validating input? (PHP)
- validating php forms (PHP)
- validating a textbox without using validation control (ASP.NET)
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development drawing encryption enum event excel file files form format ftp function gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml



