PK Singh

PK Singh

  • NA
  • 165
  • 14.3k

how can we one line loop use ?? example counter use 1 to .... how

Apr 3 2021 12:27 PM
int counter = 0;
for (int i = 0, loopTo = checkedListBox1.Items.Count - 1; i <= loopTo; i++)
{
if (Conversions.ToBoolean(checkedListBox1.GetItemCheckState(i)))
{
counter = counter + 1;
}
}
if (counter != 1 )
if (counter != 2)
if (counter != 3)
if (counter != 4)
if (counter != 5)
if (counter != 6)
if (counter != 7)
if (counter != 8)
if (counter != 9)
if (counter != 10 )
{
Interaction.MsgBox("Select all Months!!!!!!!!!");
return ;
}
 
 
 
 
how can we one line loop use counter   ??
 example counter use 1 to .... 
how pls tell 

Answers (2)