c# 中button怎样调用另一个button中生成的数组
privatevoidbtn1_Click(objectsender,EventArgse){OpenFileDialogdialog=newOpenFileDialog...
private void btn1_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string path = dialog.FileName;
textBox1.Text = path;
int[] nums = File.ReadAllLines(path, Encoding.UTF8).Select(x => Int32.Parse(x)).ToArray();
}
}
这个nums就是我需要在另一个button中调用的数组 展开
{
OpenFileDialog dialog = new OpenFileDialog();
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string path = dialog.FileName;
textBox1.Text = path;
int[] nums = File.ReadAllLines(path, Encoding.UTF8).Select(x => Int32.Parse(x)).ToArray();
}
}
这个nums就是我需要在另一个button中调用的数组 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询