c# forms

May 29 2014 2:05 AM
the messagebox work fine but the panels only show panel1 ccf only if i tick all the boxes


public partial class MainPanel : Form
{
public MainPanel()
{
InitializeComponent();
}
private void buttonSelectionSearch_Click(object sender, EventArgs e)
{
if (checkBoxCCF.Checked)
{
DialogResult resultCCF = MessageBox.Show("Do you do want to know more about " + checkBoxCCF.Text, "Warning",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (resultCCF == DialogResult.Yes)
{
//code for yes
}
else if (resultCCF == DialogResult.No)
{
panel1.Visible = checkBoxCCF.Checked;
}
else if (resultCCF == DialogResult.Cancel)
{
//code for Cancel
}

if (checkBoxReliabilty.Checked)
{
DialogResult resultREL = MessageBox.Show("Do you do want to know more about " + checkBoxReliabilty.Text, "Warning",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (resultREL == DialogResult.Yes)
{
//code for yes
}
else if (resultREL == DialogResult.No)
{
panel2.Visible = checkBoxReliabilty.Checked;
}
else if (resultREL == DialogResult.Cancel)
{
//code for Cancel
}
if (checkBoxRisk.Checked)
{
DialogResult resultRIS = MessageBox.Show("Do you do want to know more about " + checkBoxRisk.Text, "Warning",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (resultRIS == DialogResult.Yes)
{
//code for yes
}
else if (resultRIS == DialogResult.No)
{
panel3.Visible = checkBoxRisk.Checked;
}
else if (resultRIS == DialogResult.Cancel)
{
//code for Cancel
}
if (checkBoxSaftey.Checked)
{
DialogResult resultSAF = MessageBox.Show("Do you do want to know more about " + checkBoxSaftey.Text, "Warning",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (resultSAF == DialogResult.Yes)
{
//code for yes
}
else if (resultSAF == DialogResult.No)
{
panel4.Visible = checkBoxSaftey.Checked;
}
else if (resultSAF == DialogResult.Cancel)
{
//code for Cancel
}
if (checkBoxSensitivity.Checked)
{
DialogResult resultSEN = MessageBox.Show("Do you do want to know more about " + checkBoxSensitivity.Text, "Warning",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (resultSEN == DialogResult.Yes)
{
//code for yes
}
else if (resultSEN == DialogResult.No)
{
panel1.Visible = checkBoxSensitivity.Checked;
}
else if (resultSEN == DialogResult.Cancel)
{
//code for Cancel
}
if (checkBoxThroughput.Checked)
{
DialogResult resultTHR = MessageBox.Show("Do you do want to know more about " + checkBoxThroughput.Text, "Warning",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (resultTHR == DialogResult.Yes)
{
//code for yes
}
else if (resultTHR == DialogResult.No)
{
panel1.Visible = checkBoxThroughput.Checked;
}
else if (resultTHR == DialogResult.Cancel)
{
//code for Cancel
}
if (checkBoxUncertainity.Checked)
{
DialogResult resultUnc = MessageBox.Show("Do you do want to know more about " + checkBoxUncertainity.Text, "Warning",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (resultUnc == DialogResult.Yes)
{
//code for yes
}
else if (resultUnc == DialogResult.No)
{
panel1.Visible = checkBoxUncertainity.Checked;
}
else if (resultUnc == DialogResult.Cancel)
{
//code for Cancel
}
} } } } } } } }} }