2
Answers

syntax for IF statement

Sal Rosales

Sal Rosales

16y
2.1k
1

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

Answers (2)
0
Sal Rosales
NA 9 0 16y

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

thanks

0
Niradhip Chakraborty
NA 6.5k 527k 16y
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
       }
}