winforms - The statement if combobox selectedindex == 1 || 2 gives a syntax error in c# -
i'm making human animal year converter.
my code:
if (combobox2.selectedindex == 1 || 2) { combobox3.visible = true; }
i following error :
operator '||' cannot applied operands of type 'bool' , 'int'
you can't use above expression
if (combobox2.selectedindex == 1 || 2) { combobox3.visible = true; }
you have use in following way:
if (combobox2.selectedindex == 1 || combobox2.selectedindex == 2 ) { combobox3.visible = true; }
Comments
Post a Comment