Vielen Dank, hat funktioniert 😃
Hallo Community,
ich möchte um mir einige Zeilen an Code zu ersparen, Code einer Methode (die bereits existiert) aus einer anderen Methode heraus ausführen.
Dabei stieß ich aber auf ein Problem:
Methode die ausgeführt werden soll:
private void button13_Click(object sender, EventArgs e)
{
//9
PortAccess.Output(888, 1 + 2 + 4 + 8 + 16 + 64 + 128);
//Preview Checked
checkBox3.CheckState = CheckState.Indeterminate;
checkBox4.CheckState = CheckState.Indeterminate;
checkBox5.CheckState = CheckState.Indeterminate;
checkBox1.CheckState = CheckState.Indeterminate;
checkBox8.CheckState = CheckState.Indeterminate;
checkBox9.CheckState = CheckState.Indeterminate;
checkBox10.CheckState = CheckState.Indeterminate;
checkBox11.CheckState = CheckState.Indeterminate;
checkBox12.CheckState = CheckState.Indeterminate;
checkBox13.CheckState = CheckState.Indeterminate;
checkBox14.CheckState = CheckState.Indeterminate;
checkBox15.CheckState = CheckState.Indeterminate;
checkBox16.CheckState = CheckState.Indeterminate;
checkBox17.CheckState = CheckState.Indeterminate;
checkBox18.CheckState = CheckState.Indeterminate;
checkBox19.CheckState = CheckState.Indeterminate;
checkBox20.CheckState = CheckState.Indeterminate;
checkBox21.CheckState = CheckState.Indeterminate;
checkBox22.CheckState = CheckState.Indeterminate;
//Preview Unchecked
checkBox2.CheckState = CheckState.Unchecked;
checkBox6.CheckState = CheckState.Unchecked;
checkBox7.CheckState = CheckState.Unchecked;
}
Methode aus der dieser Code aufgerufen werden soll:
private void button4_Click(object sender, EventArgs e)
{
if (numericUpDown1.Value == 9)
{
Form1.button13_Click();
}
}
Bei dieser Methode erhalte ich aber den Fehler "Keine Überladung für die button13_Click-Methode nimmt 0 Argumente an."
Ich muss also dem ganzen ein Argument hinzufügen, aber welches? Ich möchte den Code so wie er da steht ausführen.
Ich weiß, eine totale anfänger Frage. Aber ich komme einfach nicht weiter.
Lg 3l3ph4nt