Form1 has the following code :
private void deleteMem_Click(object sender, EventArgs e)
{
bool delete = false;
choiceCheck choiceCheck = new choiceCheck(ref delete,"Supprimer le membre", "Êtes-vous sûr de vouloir supprimer le membre (" + CDMDisplay.Text + ") " + FNDisplay.Text + " " + LNDisplay.Text, "Supprimer", "Annuler");
choiceCheck.ShowDialog();
if (!delete) return;
...
and Form2 has :
public bool accept;
public choiceCheck(ref bool accept, string title, string message, string yesText, string noText)
{
InitializeComponent();
this.Text = title;
this.message.Text = message;
this.yesButton.Text = yesText;
this.noButton.Text = noText;
this.accept = accept;
}
private void yesButton_Click(object sender, EventArgs e)
{
accept = true;
this.Close();
}
private void noButton_Click(object sender, EventArgs e)
{
accept = false;
this.Close();
}
Form2 is like MessageBoxButtons.YesNo but as a Form. I want to pass ref of delete to Form2 and have it alter its value.
I could make 'bool delete' a public variable and then alter it from Form2 as a solution, but is there any way to alter variable delete without declaring it public ?