How do set datagridviewcheckbox as first column at every insertion of row?I am working on datagridview(dgv), and i am stuck in one issue , i.e I want to display data in dgv by taking some value from combobox(cmb). when i press select button it taking value from cmb and get related data from datatable by executing query . Now my issue comes my datatable has 4 columns (a,b,c,d) and i want to display all in dgv. i dont want to bind table to dgv but i want to add first column as dgvcheckbox and then from 2nd column my datatable columns as (2nd -a, 3rd-b, 4th -c,5th -d) like this at every insertion of rows . when query retrieves rows from table rows count may be anything. so if retrieves 2 rows 2 dgvcheckbox should add at 2 rows i.e 1st column of every row.
Is this possible ? if yes please give me a way thanks !
here is my code for help:
private void button3_Click_1(object sender, EventArgs e) //select button
DateTime date = Convert.ToDateTime(dateTimePicker1.Text);
string stname = comboBox1.SelectedValue.ToString();
string datetime = date.ToString("yyyy-MM-dd 00:00:00.000");
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Proc_GetIndentTable";
cmd.Connection = con;
cmd.Parameters.Add(new SqlParameter("@storename", stname));
cmd.Parameters.Add(new SqlParameter("@date", datetime));
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
dataGridView3.DataSource = dt;