C# logic to implement foreach loop when check box is checked -


I have a check box in a Windows application called "Sustainable" when the user checks it and clicks the "Process" button , Then the application list will process all the items in the box. However, if the user does not check this box, then it will only process the first one in the list.

In my procedure method, I want to write a condition to check the check box and executing the forehead loop is otherwise to execute the first item.

This is my code

  private zeros btnProcess_Clicl () {bool bDone = false; While (! Beadon) {load list (;); // This will load the list from database in the list if (listbox.items.Count> 0) {ProcessList (); } If (! ChkBox.Checked) bDone = true; }}  

I have applied the foreach loop to process the list in ProcachList () method. To avoid the LoadList () method to execute anyway, any Is not the way if the user checks the checkbox continuously?

Do something like this

  if (chkBox.Checked) process list (); Other process ();  

Type actions to do what you want

Update

Avoid repetition of the processing code Some things like that you can do for

  public zero process list (foreach) (different items in the list) process (item); }  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -