9
Answers

Why stack overflow exception occurs when i change file name of a .cs file before debugging?

naveen

naveen

14y
4.5k
1
Hi all ,

  I had a .cs file like comboboxControl.cs and wrote code and it debugged correctly.
But after i changed the name from  combobox.cs,when i debugged it gave an error before initialize component and said some Stackoverflow error occured .what should i do to rectify these errors.

Below is my code,where it gave error

namespace DynamicButtonControl
{
    public partial class ComboBox : Form
    {
        public ComboBox()  --> Here i got Stackoverflow exception ERROR while debugging ,after changing file name alone.
        {
            InitializeComponent();
            createDynamicComboBox();
        }
        private void createDynamicComboBox()
        {
            ComboBox combo1 = new ComboBox();
            combo1.Location = new System.Drawing.Point(30, 70);
            combo1.Name = "comboBOX1";
            combo1.Size = new System.Drawing.Size(200, 30);
            combo1.BackColor = System.Drawing.Color.Orange;
            combo1.ForeColor = System.Drawing.Color.Black;
            Controls.Add(combo1);
        }
    }
}

thanks in advance
Answers (9)