Using && instead of &.
if (phContent.Controls[0].ID == "ucSwJobs" & ((SWJobs)phContent.Controls[0]).CheckForCheckedJobs())
{
ShowMessage("You still have selected jobs in SW Jobs!");
}
If we used & in the above if statement we would get an error because the second evaluation relies on the first one being true. If we used && the first statement would fail and the second statement would throw an error.
By using a double && we stop the second statement being evealuated if the first fails!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment