I have two classes, one is the main program, the other a options menu. I coded it so that the options class is able to get a check box visible or invisible as soon as the option in options menu is checked using the following:
on the main class:
//public boolean to manipulate the checkBox54 that exists on the main class
public Boolean mostracaixabetaofresco
{
//the problem is this get, i don't understand what should i place in here,
//although i have read the msdn about accessors, it only has examples for variables, not properties
get { return checkBox54.Visible; }
set { checkBox54.Visible = value; }
}
//toolstrip button that redirects to the the options class
private void configuraçãoToolStripMenuItem_Click(object sender, EventArgs e)
{
//formOpConfig is the name of the class with the options menu
formOpConfig painelconfig = new formOpConfig(this);
painelconfig.ShowDialog();
}
on the options class i have
public partial class formOpConfig : Form
{
public static string xmlDialogconstante { get; set; }
private Form1 Opener { get; set; }
public formOpConfig(Form1 opener)
{
this.Opener = opener;
this.Opener.mostracaixabetaofresco = false; //or false accordingly to needs
}
}
This works pretty well, but i hate not knowing what i'm doing, I'm also not sure why do i have to place checkBox54.Visible in the get {}.
I'm very new to programming, and i'm not able to contact the person who helped me on this a few months ago. Can someone bring some lights into how this is working?