title: c# How to get index of panel control placed in tabcontrol's current tabpage
body: <p>I am using this code to get the panel control index placed in the current tabpage controls list of tabcontrol1 , but I am not able to do it . How to get the index of this panel ? The name of the panel is same as label1.Text</p>
  
  <pre><code>int count = 0;int index=0;
            foreach (var item in tabControl1.TabPages[tabControl1.SelectedIndex].Controls)
            {
                if (item.Name == label1.Text)
                {
                    index = count;
                    break;
                }
                else
                {
                    count++;
                }
            }
  </code></pre>