I have been trying to implement and adapt my coding style moving form more of a procedural programming style but have been running into problems, when trying to run another class working with the systems registry. Furthermore the code works fine in the main class. P.S I come form a scripting background.
Code Error: An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll
I have cut down the code from the main application to make it easier to find the problem.
Main Form Class:
public partial class Form1test : Form
{
// An unhandled exception of type 'System.StackOverflowException'
// occurred in System.Windows.Forms.dll
public Form1test()
{
TestClass lsr = new TestClass();
lsr.chkRegAct();
InitializeComponent();
}
}
TestClass:
class TestClass : Form1test
{
//rest of code
}
TestClass is derived from Form1Test.
You create a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates a new TestClass which results to calling the constructor of base class (Form1Test) which generates .....
StackOverflowException due to lot of function calls caused by infinite recursion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With