|
-
Jun 12th, 2007, 04:27 AM
#1
Thread Starter
PowerPoster
simple IF statement
bit of a slow day!
I want to check if:
textbox1 or textbox2 length == 0 AND IF checkbox1 OR checkbox2 is checked then validation has failed
how can I do this?
This doesnt work:
if (this.textbox1.Length == 0 || this.textbox2.Length == 0 && this.checkbox1.Checked || this.checkbox2.Checked)
{
//validation failed.
}
-
Jun 12th, 2007, 04:35 AM
#2
Re: simple IF statement
Do you know what order those logical operators are going to be evaluated in? If you want to control the order of evaluation then use parentheses, just like a mathematical equation.
Also, the TextBox class doesn't have a Length property. It would have to be either TextLength or Text.Length.
-
Jun 12th, 2007, 05:33 AM
#3
Thread Starter
PowerPoster
Re: simple IF statement
sorry yes you are right (i was just typing it in here). And managed to solve it after I posted lol
Thanks jm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|