Asked By Blair Yumi
01-Dec-10 02:49 AM

Hi, can some on help me with my problem?
How can I add a checkbox column programmatically and making it as a first column.
here is my code, but the checkbox is at the last column.
private void Form1_Load(object sender, EventArgs e)
{
string stat = "";
int ave = 0;
dataGridView1.ColumnCount = 5;
DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
dataGridView1.Columns.Add(chk);
chk.HeaderText = "Check Data";
chk.Name = "chk";
dataGridView1.Columns[1].Name = "Substation/Office";
dataGridView1.Columns[2].Name = "IP Address";
dataGridView1.Columns[3].Name = "Status";
dataGridView1.Columns[4].Name = "Average";
string[] row = new string[] { "ce", "1", stat};
dataGridView1.Rows.Add(row);
row = new string[] { " Da", "1.1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "s", "19", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "cat", "1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "te", "6.1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "ffice", ".1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "ca", "51.1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "ban", "1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "Office", "1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "or", "19", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "Sur", "19", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "C", "3.1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "Norte", "1", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "Sto", "10", stat };
dataGridView1.Rows.Add(row);
row = new string[] { "mail", "1", stat };
dataGridView1.Rows.Add(row);
}
the checkbox column always appear at the last column of the grid view.
ANd this is the scenario:
the first column should be a checkbox column and the latter columns
accept string values,i can make the 1st column to appear first but i
can't add the other columns,can someone help me with this problem?
thanks a lot po...