如何在按钮单击事件中引用另一个事件中的成员
在button1_Click 中调用 a b c? private void button1_Click(object sender, EventArgs e)
{
}
public void show(object sender, EventArgs e)
{
listBox1.Items.Clear();
Random k = new Random();
int a = k.Next(20);
int b = k.Next(20);
int c = k.Next(20);
listBox1.Items.Add(a );
listBox1.Items.Add(b );
listBox1.Items.Add(c );
}
如:{
}
public void show(object sender, EventArgs e)
{
listBox1.Items.Clear();
Random k = new Random();
int a = k.Next(20);
int b = k.Next(20);
int c = k.Next(20);
listBox1.Items.Add(a );
listBox1.Items.Add(b );
listBox1.Items.Add(c );
}
private void button1_Click(object sender, EventArgs e)
{
int k =a +b +c ;//对show中a b c的调用如何实现?
}
求助!!