我无法弄清楚如何随机生成存储在listbox1中的数据并在Datagridview中随机对其进行排序。我想通过私有的void button3_Click来完成所有这些。 datagridview有2列,Team 1和Team 2.两列都需要listbox1中的数据。感谢
private void button1_Click(object sender, EventArgs e)
{
string n = textBox1.Text;
string n2 = textBox2.Text;
string[] names = new string[] { n, n2 };
IEnumerable<string> nameQuery =
from name in names
select name;
foreach (string i in nameQuery)
{
listBox1.Items.Add(i + " ");
}
}
private void button2_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
}
private void button3_Click(object sender, EventArgs e)
{
}
}
}