110,545
社区成员
发帖
与我相关
我的任务
分享
private void AddRow_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Add("", "", "");
}
private void Print_Click(object sender, EventArgs e)
{
int count = 0;
int total = 0;
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
count = int.Parse(dataGridView1.Rows[i].Cells["c"].Value.ToString());
total += int.Parse(dataGridView1.Rows[i].Cells["c"].Value.ToString());
dataGridView2.RowCount = total;
for (int j = 0; j < total; j++)
{
for (int n = 0; n <= count; n++)
{
dataGridView2.Rows[j].Cells[0].Value = dataGridView1.Rows[i].Cells[0].Value;
dataGridView2.Rows[j].Cells[1].Value = dataGridView1.Rows[i].Cells[1].Value;
}
}
}
}