?? 不能再form中显示?
程序代码:
namespace 数据排序 { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void Form2_Activated(object sender, EventArgs e) { textBox1.Text = ""; textBox1.Focus(); label1.Text = "please input:" + (Form1.i + 1) + "geshu"; } private void button1_Click(object sender, EventArgs e) { Form1.num[Form1.i] = int.Parse(textBox1.Text); } } }namespace 数据排序 { public partial class Form1 : Form { public static int[] num = new int[10]; public static int i; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); for (int i = 0; i < 10; ) { if (DialogResult.OK == frm2.ShowDialog()) i++; } label1.Text += " the num is \n\n\n"; for (i = 0; i < 10; i++) label1.Text += num[i] + " "; int tempt = num[0]; for (i = 0; i <= 10; i++) { for (int j = i + 1; j < 10; j++) { if (num[i] > num[j]) { tempt = num[i]; num[i] = num[j]; num[j] = tempt; } } } for (i = 0; i <= 10; i++) label1.Text += num[i] + " "; } } }