-2
當我嘗試從不同勢按鈕來訪問布爾變量喜歡這裏:訪問按鈕的變量
private void button1_Click(object sender, EventArgs e)
{
//Those my bool variable I want to access from the second button
bool second = false , third = false , forth = false , fifth = false;
}
private void button4_Click(object sender, EventArgs e)
{
//Here is where I try to access, but i can't.
second = true;
}
謝謝。
是否確定你剛剛做了,你在第一個按鈕中聲明瞭一個局部變量nd你想從外部函數中改變它的值 –