title: Thrown system.exception.stackoverflowexception C#
body: <p>In my C# windows form application, there is a combo box that has 3 options in it, when selecting second one a switch command that checks options of another combo box throws and exception of type stack overflow, with this details:</p>
  
  <p><img src="https://i.stack.imgur.com/OqXJH.jpg" alt="image here"></p>
  
  <blockquote>
    <p>System.StackOverflowException occurred  </p>
    
    <p>HResult=0x800703E9<br>
          Source=&lt;Cannot evaluate the exception source><br>
          StackTrace:<br>
         &lt;Cannot evaluate the exception stack trace></p>
  </blockquote>
  
  <p>Update:</p>
  
  <p>this is the event of index change in combo box:</p>
  
  <pre><code>private void cmbxDoorType_SelectedIndexChanged(object sender, EventArgs e)
      {
          if (cmbxDoorType.SelectedIndex == 0)
          {
              chkTopBlock.Enabled = true;
              if(chkTopBlock.Checked)
                  cmbxTopBlockConfig.Enabled = true;
              cmbxTopSideConfig.Enabled = true;
              txtDoorHeight.ReadOnly = false;
              txtTotalWidth.Visible = false;
              lblTotalWidth.Visible = false;
              lblDoorBaleWidth.Enabled = false;
  
          }
          else if (cmbxDoorType.SelectedIndex == 1)
          {
              txtTotalWidth.Visible = false;
              lblTotalWidth.Visible = false;
              lblDoorBaleWidth.Enabled = false;
              cmbxTopBlockConfig.Enabled = false;
              chkTopBlock.Enabled = false;
              txtDoorHeight.ReadOnly = true;
              cmbxTopSideConfig.Enabled = false;
          }
          else
          {
              chkTopBlock.Enabled = true;
              if (chkTopBlock.Checked)
                  cmbxTopBlockConfig.Enabled = true;
              cmbxTopSideConfig.Enabled = true;
              txtDoorHeight.ReadOnly = false;
              txtTotalWidth.Visible = true;
              lblTotalWidth.Visible = true;
              lblDoorBaleWidth.Enabled = true;
  
          }
          Prediction();
      }
  </code></pre>
  
  <p>this is the prediction methode than exception ocours in:</p>
  
  <pre><code>internal void Prediction ()
      {
          if (Globals.ProjectType=="Gama")
          {
              int TotalHeight_=0;
              double DesignHeight_=0;
              int TotalWidth_=0;
              double LeftDis = 0;
              double RightDis = 0;
              double RowsTotalHeight_=0;
              double TopBlockHeight_=0;
              double thisDoorHeight_ = 0;
              int DoorHeight_=0;
              int DoorWidth_=0;
              double DoorBaleWidth_=0;
              try
              {
                  switch (cmbxLeftSideConfig.SelectedIndex)  //exception thrown here
                  {
                      case 0:
                          LeftDis = GamaGlobals.Constants.BeamThickness - GamaGlobals.Constants.InsertOffset;
                          break;
                      case 2:
                          LeftDis = GamaGlobals.Constants.GP115Body + GamaGlobals.Constants.BeamThickness - GamaGlobals.Constants.InsertOffset;
                          break;
                      case 3:
                          LeftDis = GamaGlobals.Constants.GP114Body + GamaGlobals.Constants.BeamThickness - GamaGlobals.Constants.InsertOffset;
                          break;
                      case 4:
                          LeftDis = GamaGlobals.Constants.GP117Height - GamaGlobals.Constants.InsertOffset;
                          break;
                      case 1:
                          LeftDis = 0;
                          break;
                  }
  
                  switch (cmbxRightSideConfig.SelectedIndex)
                  {
                      case 0:
                          RightDis = GamaGlobals.Constants.BeamThickness - GamaGlobals.Constants.InsertOffset;
                          break;
                      case 2:
                          RightDis = GamaGlobals.Constants.GP115Body + GamaGlobals.Constants.BeamThickness - GamaGlobals.Constants.InsertOffset;
                          break;
                      case 3:
                          RightDis = GamaGlobals.Constants.GP114Body + GamaGlobals.Constants.BeamThickness - GamaGlobals.Constants.InsertOffset;
                          break;
                      case 4:
                          RightDis = GamaGlobals.Constants.GP117Height - GamaGlobals.Constants.InsertOffset;
                          break;
  
  
       case 1:
                              RightDis = 0;
                              break;
                      }
  }
  </code></pre>