title: Visual C# windows forms constantly check and update value?
body: <p>I'm doing a project for college and have create a panel with a simple lunch menu. Each item of the menu if presented by a check box. What I wanted to happen was for the total to be changed every time a new item is checked or unchecked. This is the code I have tried using so far but it seems to freeze the program when I run it. I have tried using a while loop to constantly check if the check boxes are checked or un-checked.</p>
  
  <p>There is a panel with the check boxes inside and a label at the bottom of the panel.</p>
  
  <p>Am I on the right line in terms of using the while loop to check what the checked status of each check box is and update the label text accordingly? </p>
  
  <pre><code>private void plBistro_Paint(object sender, PaintEventArgs e)
          {
              //create a variable to hold the total
              double bistotal = 0.0;
  
              while(bistotal != 99){
                  //check if they chose a ham sandwich
                  if(cbHamSandwich.Checked == true){
  
                      //if they did add 1.20 to the value of bistotal
                      bistotal = bistotal + 1.20;
                  }
  
              string bistotalString = Convert.ToString(bistotal);
  
              lblBistroTotal.Text = bistotalString;
          }
          }
  </code></pre>