R
Richard Lionheart
Hi All,
I coding a simple web form that generates
- a couple of operand textboxes,
- a dropdown list of operations
- a "results" textbox
- an "error msg" label
The following code validates the operations list correctly.
However, it doesn't output any message when the first operand is blank.
What do I need to do to get the operand validation to output to lblMessage
when operand #1 is blank.
Should I just copy and paste the corrected code to perform the same check on
operand #2?
==============
private void btnEquals_Click(object sender, System.EventArgs e)
{
RegularExpressionValidator rev = new RegularExpressionValidator();
rev.ControlToValidate="tbOperand1";
rev.ValidationExpression="^\\d+$";
rev.ErrorMessage="The operands must contain only digits and at least one";
rev.Visible=true;
rev.Validate("tbOperand1");
if (cbOperation.SelectedItem.Text == "?")
{
lbMessage.Text = "Please select an operation in place of \"?\"";
return;
}
}
==============
Regards,
Richard
I coding a simple web form that generates
- a couple of operand textboxes,
- a dropdown list of operations
- a "results" textbox
- an "error msg" label
The following code validates the operations list correctly.
However, it doesn't output any message when the first operand is blank.
What do I need to do to get the operand validation to output to lblMessage
when operand #1 is blank.
Should I just copy and paste the corrected code to perform the same check on
operand #2?
==============
private void btnEquals_Click(object sender, System.EventArgs e)
{
RegularExpressionValidator rev = new RegularExpressionValidator();
rev.ControlToValidate="tbOperand1";
rev.ValidationExpression="^\\d+$";
rev.ErrorMessage="The operands must contain only digits and at least one";
rev.Visible=true;
rev.Validate("tbOperand1");
if (cbOperation.SelectedItem.Text == "?")
{
lbMessage.Text = "Please select an operation in place of \"?\"";
return;
}
}
==============
Regards,
Richard