title: Pass a value if a checkbox is checked
body: <p>I have a form that has some textboxes (45) with CheckBoxes next to each, and a button. When the button is pressed I want to pass the values of each Textbox that has a checked CheckBox to a void in another class and the ones that are not checked pass a null value.</p>
  
  <p>What I have at the moment is:
  <strong>Form1</strong></p>
  
  <pre><code>private void button_Click(object sender, EventArgs e)
  {
  String Value1;
  if (value1CheckBox.Checked)
  {
      Value1 = value1TextBox.Text;
  }
  else
  {
      Value1 = null;
  }
  
  String Value2;
  if (value2CheckBox.Checked)
  {
      Value2 = value1TextBox.Text;
  }
  else
  {
      Value2 = null;
  }
  
  etc...
  
  Form2 form2 = new Form2();
  form2.insertSQL(Value1, Value2, etc...);
  }
  </code></pre>
  
  <p><strong>Form2</strong></p>
  
  <pre><code>private void insertSQL(String Value1, String Value2, String etc...)
  {
      /*
      Code to insert to SQL database
      */
  }
  </code></pre>
  
  <p>But that seams very inefficient and I'm sure there must be a better way to pass the values if the boxes are checked. Any advice on a better way to do this would be appreciated, also sorry if I have used the wrong terminology I am very new to programing.</p>