❔ Error idk how to fix

can someone please look thought my code and time me why i get this error
33 Replies
Jimmacle
Jimmacle2y ago
1) you need to provide more detail 2) nobody is going to debug your entire project for you 3) nobody is going to download and open a mystery zip file
PhoenixXeme
PhoenixXemeOP2y ago
im not asking for someone to debug the enitre project i have no idea how to fix the error its giving me
Jimmacle
Jimmacle2y ago
you didn't actually share an error just the line it's breaking on
PhoenixXeme
PhoenixXemeOP2y ago
thats all its giving me XD
Jimmacle
Jimmacle2y ago
it's not
PhoenixXeme
PhoenixXemeOP2y ago
yea it is
Jimmacle
Jimmacle2y ago
StackOverflowException is the error there should also be a stack trace showing what code lead to the error
Gipper
Gipper2y ago
This is just a wild guess so take it with a sizeable amount of salt but in C# stack overflows are frequently caused by an infinite recursion somewhere so if you can think of somewhere in your code where that may have happened, examine it closely
PhoenixXeme
PhoenixXemeOP2y ago
i did i cant really see anything
namespace WFA_Gaming_Notepad
{
public partial class Form1 : Form
{
public Settings settings { get; set; }

bool settingsVisable = false;

public Form1()
{
InitializeComponent();

settings1.Hide();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void btnSettings_Click(object sender, EventArgs e)
{
settingsVisable = !settingsVisable;

if (settingsVisable)
{
settings.Show();
}
else
{
settings.Hide();
}
}
}
}
namespace WFA_Gaming_Notepad
{
public partial class Form1 : Form
{
public Settings settings { get; set; }

bool settingsVisable = false;

public Form1()
{
InitializeComponent();

settings1.Hide();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void btnSettings_Click(object sender, EventArgs e)
{
settingsVisable = !settingsVisable;

if (settingsVisable)
{
settings.Show();
}
else
{
settings.Hide();
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WFA_Gaming_Notepad
{
public partial class Settings : UserControl
{

Form1 form1 = new Form1();

public Settings()
{
InitializeComponent();

}

private void Settings_Load(object sender, EventArgs e)
{

}

private void cbSettings_OnTop_CheckedChanged(object sender, EventArgs e)
{
if (cbSettings_OnTop.Checked)
{
form1.TopMost = true;
}
else if (!cbSettings_OnTop.Checked)
{
form1.TopMost = false;
}
else
{
MessageBox.Show("Error: cbSettings_OnTop");
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WFA_Gaming_Notepad
{
public partial class Settings : UserControl
{

Form1 form1 = new Form1();

public Settings()
{
InitializeComponent();

}

private void Settings_Load(object sender, EventArgs e)
{

}

private void cbSettings_OnTop_CheckedChanged(object sender, EventArgs e)
{
if (cbSettings_OnTop.Checked)
{
form1.TopMost = true;
}
else if (!cbSettings_OnTop.Checked)
{
form1.TopMost = false;
}
else
{
MessageBox.Show("Error: cbSettings_OnTop");
}
}
}
}
thos are my 2 scripts idk where that is
Jimmacle
Jimmacle2y ago
you have infinite recursion your Form1 creates a Settings which creates a Form1 which creates a Settings and so on until your program crashes
Gipper
Gipper2y ago
I am big 🧠
PhoenixXeme
PhoenixXemeOP2y ago
so how would i fix that im still new to C# XD
Jimmacle
Jimmacle2y ago
you need to get rid of Form1 form1 = new Form1(); in your Settings class specifically the new Form1() part you probably want to reference the original form that opened, not create a new one
PhoenixXeme
PhoenixXemeOP2y ago
Jimmacle
Jimmacle2y ago
an image with no context does nothing for me
PhoenixXeme
PhoenixXemeOP2y ago
namespace WFA_Gaming_Notepad
{
public partial class Form1 : Form
{
public Settings settings { get; set; }

bool settingsVisable = false;

public Form1()
{
InitializeComponent();

settings1.Hide();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void btnSettings_Click(object sender, EventArgs e)
{
settingsVisable = !settingsVisable;

if (settingsVisable)
{
settings.Show();
}
else
{
settings.Hide();
}
}
}
}
namespace WFA_Gaming_Notepad
{
public partial class Form1 : Form
{
public Settings settings { get; set; }

bool settingsVisable = false;

public Form1()
{
InitializeComponent();

settings1.Hide();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void btnSettings_Click(object sender, EventArgs e)
{
settingsVisable = !settingsVisable;

if (settingsVisable)
{
settings.Show();
}
else
{
settings.Hide();
}
}
}
}
Jimmacle
Jimmacle2y ago
this also does nothing for me use your words
PhoenixXeme
PhoenixXemeOP2y ago
nvm
PhoenixXeme
PhoenixXemeOP2y ago
i get this when i press there settings button
Jimmacle
Jimmacle2y ago
why do you think that is?
PhoenixXeme
PhoenixXemeOP2y ago
because im tired i see it works now and now i get this when i check the on top button
PhoenixXeme
PhoenixXemeOP2y ago
PhoenixXeme
PhoenixXemeOP2y ago
my brain dose not work rn
Jimmacle
Jimmacle2y ago
maybe sleep on it
PhoenixXeme
PhoenixXemeOP2y ago
please just help me i mean idk how to do it and im tired
Jimmacle
Jimmacle2y ago
it's the exact same problem you just had with the other piece of code
PhoenixXeme
PhoenixXemeOP2y ago
the problem with the other code was i didnt put a "1" but when i do it with this script it gives an error
PhoenixXeme
PhoenixXemeOP2y ago
Jimmacle
Jimmacle2y ago
you should probably start with a simpler project something that doesn't involve a GUI framework that's doing things behind the scenes and confusing you
PhoenixXeme
PhoenixXemeOP2y ago
maybe your right ill just delete the project
Gipper
Gipper2y ago
dont delete, put it aside and come back later when you know more
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server