Skip to content

Syntax for IF statement

Sal Rosales

Asked May 22, 2008, 10:04 AM EDT2 answers
Share
LinkedInX

Hi everyone,

I have this if statement:

if (ctrl.Controls[0].Controls[0] is CheckBox)

What is the syntax to check if it is NOT a CheckBox?

thanks

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Niradhip Chakraborty
    0
    foreach (Control control in Controls)
    {
          if (control is CheckBox)
          {
             //  you know code here for control which is checkbox
          }
          else
           {
            //  you know code here for control which is not checkbox
           }
    }
    0
  • 0

    ok, I just throught there might have been a If (control is not checkbox). An else statement it will be.

    thanks

    0