| | |
Windows Forms Input Validation with Validating Event and ErrorProvier Control
Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
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 |
.net access algorithm array asp.net bitmap box broadcast c# check checkbox client combobox communication control conversion csharp database datagrid datagridview dataset datetime dbconnection decryption degrees design developer draganddrop drawing encryption enum eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net hospitalmanagementsystem image input install interface java libraries list loop marshalbyrefobject math mouseclick movingimage mysql netcfsvcutil.exe numeric operator path photoshop php picturebox pixelinversion platform polynomial post programming properties radians read regex remoting richtextbox server sleep socket sql statistics string stringformatting study sun system.servicemodel table tcpclientchannel text textbox thread time timer update usb usercontrol validation visualstudio webbrowser winforms wpf wpfc# xml



