Home c# System.StackoverFlowException: "The" System.StackOverFlowException "type is issued."

System.StackoverFlowException: “The” System.StackOverFlowException “type is issued.” [Duplicate]

Author

Date

Category

Total 2 forms and I want to make references so that in form 2 use Methods of form 1 and in form 1 use form 2 methods, but it writes an error. (If you remove Private Form1 _Form1 = New Form1 (); out of 2 forms, everything works, without calls of methods of course.)


Answer 1

As an option, you can use Static methods into the Private place and then creating an instance of the class will not need. Calling methods will be implemented in format Form1. Note the method (parameters). However, in static methods, only static variables will be used in static methods.


Answer 2

Public Partial Class Form1: Form
{
  Private Form2 _form = new form2 () {_form1 = this};
  Private ToolStripbutton [] _ToolStripbutton;
Public Partial Class Form2: Form
{
  Public Form1 _Form1;
  Private RadioButton [] _RadioButtons;

Answer 3

Public Partial Class Form1: Form
{
  Private Form2 _form = New Form2 (this);
  Private ToolStripbutton [] _ToolStripbutton;
Public Partial Class Form2: Form
{
  Private Form1 _Form1;
  Private RadioButton [] _RadioButtons;
  Public Form2 (Form1 _Form1) {
   this._form1 = _form1;
  }

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions