title: C# - edit text property for tab pages at runtime
body: <p>I have a tab control to which I can add new tab pages typing in a textbox the name to be showed for each tab. What i want to do is to be able to right click on a tab and rename it (to allow me to edit the text), like the option in many other apps... I have a "remove tab" option already in place and working but I cannot find  a way to rename the selected tab..</p>
  
  <p>Any help is much appreciated!</p>
  
  <p>this is my code for remove option if can be at any help..</p>
  
  <pre><code>public Form1()
      {
          InitializeComponent();
          ContextMenu cm = new ContextMenu();
          cm.MenuItems.Add("Remove", new EventHandler(rmv_click));
          cm.MenuItems.Add("Rename");
          tabControl1.ContextMenu = cm;
  
  
      }
  //select tab on right mouse click
          private void tabControl_MouseDown(object sender, MouseEventArgs e)
          {
              if (e.Button == MouseButtons.Right)
              {
                  for (int i = 0; i &lt; this.tabControl1.TabCount; ++i)
                  {
                      if (this.tabControl1.GetTabRect(i).Contains(new Point(e.X, e.Y)))
                      {
                          this.tabControl1.SelectedIndex = i;
                          break;
                      }
                  }
              }
          }
  
  //remove selected tab
      private void rmv_click(object sender, System.EventArgs e)
      {
          tabControl1.TabPages.Remove(tabControl1.SelectedTab);
      }
  </code></pre>