Sorry, I am new to C# and am unsure what I am doing wrong.
Here is the code I am using:
private void chkSmallMenu_CheckedChanged(object sender, EventArgs e)
{
frmSmallMenu sm = null;
if (chkSmallMenu.Checked)
{
if (sm is null || sm.IsDisposed)
{
sm = new frmSmallMenu();
}
sm.Show();
}
else
{
MessageBox.Show("close");
sm?.Close();
}
}
The window will open but when I uncheck the box nothing happens and I have no idea why. I have tried looking for an answer but nothing has worked for me.