这是webform(asp.net c#)的代码:
protected void Button2_Click(object sender, EventArgs e)
{
int no1;
int no2;
int no3;
int no4;
int no5;
int no6;
int no7;
int no8;
int no9;
no1 = int.Parse(txt1.Text);
no2 = int.Parse(txt2.Text);
no3 = int.Parse(txt3.Text);
no4 = int.Parse(txt4.Text);
no5 = int.Parse(txt5.Text);
no6 = int.Parse(txt6.Text);
no7 = int.Parse(txt7.Text);
no8 = int.Parse(txt8.Text);
no9 = int.Parse(txt9.Text);
int[] a = new int[] {no1,no2,no3,no4,no5,no6,no7,no8,no9 };
Array.Sort(a);
foreach (var str in a)
{
MessageBox.Show(str.ToString()); //display in MessageBox, but i want to display back to 9 different textbox.
}我可以在MessageBox中显示结果。但是我不能将结果显示回9个不同的文本框。我怎样才能找到解决方案?谢谢这是输出的http://i.gyazo.com/a91f7ffef1d6d1fa7815890464df3082.png
发布于 2016-06-23 07:44:44
txt1.Text = a[0];
txt2.Text = a[1];
txt3.Text = a[2];
txt4.Text = a[3];
txt5.Text = a[4];
txt6.Text = a[5];
txt7.Text = a[6];
txt8.Text = a[7];
txt9.Text = a[8];如果我没理解错的话,这应该可以完成这项工作。
https://stackoverflow.com/questions/31569736
复制相似问题