我需要为相同的“ ComboBox Text Header” comboBox 1“ Stations”和comboBox2“ Citiyes”添加不同的项目, 第二行[第2行]。 以及三个[Row = 3]的不同项目,依此类推。.[Row = 8]。
private void Form1_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("ID");
dt.Columns.Add("Branches");
dt.Rows.Add("1", "Khartuom");
dataGridView1.DataSource = dt;
DataGridViewComboBoxColumn combo = new DataGridViewComboBoxColumn();
combo.HeaderText = "Stations";
combo.Items.Add("Al mena");
combo.Items.Add("Bahir New Station");
combo.Items.Add("Libia");
combo.Items.Add("PUblic shog");
dataGridView1.Columns.Add(combo);
DataGridViewComboBoxColumn combo2 = new DataGridViewComboBoxColumn();
combo2.HeaderText = "Citiyes";
combo2.Items.Add("Port Sudan");
combo2.Items.Add("Kasala");
combo2.Items.Add("Madani");
combo2.Items.Add("AlNohod");
dataGridView1.Columns.Add(combo2);
DataGridViewLinkColumn link = new DataGridViewLinkColumn();
link.HeaderText = "Links page";
dataGridView1.Columns.Add(link);
DataGridViewImageColumn Image = new DataGridViewImageColumn();
Image.HeaderText = "Delete";
dataGridView1.Columns.Add(Image);
DataGridViewImageColumn Image2 = new DataGridViewImageColumn();
Image2.HeaderText = "Edit";
dataGridView1.Columns.Add(Image2);
}
}
}