This is my first full sized c# project, so I apologize if the answer if the answer here was obvious.
I've got a program that runs a method called firstrun, which is called at the point that the form loads (if a value from a file is true).
This method reveals a settings panel, which gives access to various buttons ect.
Image:
Click Here
I want the user to enter values into both of the text boxes, before clicking OK. I was planning to do this by using a boolean array (initialised at the start of the firstrun method) with two values, each of which is set to true when the corresponding box is filled.
The thing is, when the 'browse' button is clicked, the button_click method is called, which then means that I can't set the boolean array value to true without using a global variable (I'm trying to minimise use of these) .
public void FirstRunProc()
{
//This runs if first execution is true. Below is user message.
MessageBox.Show("this is the first time you've run this program.\nand where you want your maps to be stored (optional).");
MessageBox.Show("Please set the path of your server's .jar file,\nand where you want your maps to be stored (optional)");
//making sure both boxes are checked
bool[] fillallcheck = new bool[2];
pnlSettingsMenu.Visible = true;
btnCancelSettings.Enabled = false;
btnRestoreDefaultsProc.Enabled = false;
}
private void btnBrowseForJar_Click(object sender, EventArgs e){
ofdBrowseForGeneric.Filter = "jar files (*.jar)|*.jar|All files (*.*)|*.*";
DialogResult browseForJarResult = ofdBrowseForGeneric.ShowDialog();
if (browseForJarResult == DialogResult.OK){
tbJarPathDisplay.Text = ofdBrowseForGeneric.FileName;
GlobalVariables[2] = ofdBrowseForGeneric.FileName;
}
}
Any help is appreciated.
- Alex.