title: The click event function unexpectedly called multiple times because of some unknown reasn
body: <p>Below is an click event for listbox 3. The problem   is if I don't include <code>listbox3.Visible=false</code> in the <code>listbox3.click</code> event handler it works fine. But if i include it in the code, it works fine for first selection from the <code>lisbox3</code> but for further selection, it gets called multiple times. I tried to change position of <code>listbox3.visible=false</code> statement but the it keep showing the same behaviour. if I add
      listBox3.Click -= new EventHandler(listBox3_Click); at the end of lisbox3.click(),then it works fine. But still I am nt able to understand the reason for multiple calling of the click event handler. Please help</p>
  
  <pre><code>private void Heading_or_project_Click(object sender, EventArgs e)
  {
      listBox3.Visible = true;
      listBox3.Click += new EventHandler(listBox3_Click);
  }
  
  public void listBox3_Click(object sender, EventArgs e)
  {
  
          listBox3.Visible = false;
          int i = listBox3.SelectedIndex;
          switch (i)
          {
              case 0: button1_Click(sender, e);
                  break;
              case 1: new_heading_just_created = 1;
                      Heading next_heading = new Heading();
                      next_heading.per_topic_button.TabIndex = heading_wise.Count;
                      next_heading.per_topic_button.Click += new EventHandler(per_topic_button_Click);
  
  
                      flowLayoutPanel2.Controls.Add(next_heading.head);
  
                      heading_wise.Add(next_heading);
                  break;
  
              default:
                  break;
          }
  </code></pre>