I put two textbox in user control in C# winform.txtFrom and txtTo. I want to compare two textbox.text and if txtTo is less than txtFrom , error provider are shown.
how do I do?
I put two textbox in user control in C# winform. txtFrom and txtTo .
Share
You don’t compare something with error provider. Error provider only shows that control has an error associated with control.
txtFrom.TextandtxtTo.Text(e.g. during Validating event)errorProvider1.SetError(txtTo, "Text is less than txtFrom"), otherwise callerrorProvider1.SetError(txtTo, "")How to do comparison:
Consider also using
NumericUpDowncontrol to avoid text parsing stuff.