title: Dynamically added CheckBoxes to a CheckBoxList not showing Text
body: <p>Following is my code for adding CheckBoxes dynamically to a CheckBoxList:</p>
  
  <pre><code>foreach (WCore.CategoryFields cat in Global.getCategories())
  {
          CheckBox c = new CheckBox();
          c.Text = cat.CategoryId;
          c.Tag = cat.CategoryName;
          if (ints != null)
          {
              if (ints.Contains(c.Tag))
                 Invoke(new Action(()=&gt;checkedListBox1.Items.Add(c, true)));
              else
                 Invoke(new Action(()=&gt;checkedListBox1.Items.Add(c, false)));
          }
          else
              Invoke(new Action(()=&gt;checkedListBox1.Items.Add(c, false)));
  }
  </code></pre>
  
  <p>The problem is that whenever I run this code, the checkboxes are added but not with the text. Like this:
  <img src="https://i.stack.imgur.com/w94Nx.png" alt="enter image description here"></p>
  
  <p>I tried to debug it and then I found that CheckBox instance 'c' is getting Text but not showing it. </p>
  
  <p>See here:
  <img src="https://i.stack.imgur.com/hCCIu.png" alt="enter image description here"></p>
  
  <p>Please tell me what's wrong going on in this code?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Please note that I can't use it like this:</p>
  
  <pre><code>Invoke(new Action(()=&gt;checkedListBox1.Controls.Add(c)));
  </code></pre>
  
  <p>because its better to use panel instead of CheckBoxList then.
  Also I want two values one shown as text and other hidden as value for each CheckBox in CheckBoxList</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Code to get selected items:</p>
  
  <pre><code>List&lt;string&gt; SelInts = new List&lt;string&gt;();
  foreach (ListBoxItem c in checkedListBox1.SelectedItems)
  {
          SelInts.Add(c.Tag.ToString());
  }
  </code></pre>