public void loadDataGrid(string sqlQueryString) { OleDbCommand SQLQuery = new OleDbCommand(); DataTable data = null; dataGridView1.DataSource = null; SQLQuery.Connection = null; OleDbDataAdapter dataAdapter = null; dataGridView1.Columns.Clear(); SQLQuery.CommandText = sqlQueryString; SQLQuery.Connection = conn; data = new DataTable(); dataAdapter = new OleDbDataAdapter(SQLQuery); dataAdapter.Fill(data); dataGridView1.DataSource = data; dataGridView1.AllowUserToAddRows = false; dataGridView1.ReadOnly = true; dataGridView1.Columns[0].Width = 20; dataGridView1.Columns[1].Width = 90; dataGridView1.Columns[2].Width = 90; dataGridView1.Columns[3].Width = 90; } DataGridViewColumn EDR; // new column DataGridViewCell EDRcell; // textbox cell in column private void button1_Click(object sender, EventArgs e) { EDR = new DataGridViewColumn(); EDRcell = new DataGridViewTextBoxCell(); EDR.CellTemplate = EDRcell; EDR.HeaderText = "RedcordType"; EDR.Name = "RedcordType"; EDR.Visible = true; EDR.Width = 45; dataGridView1.Columns.Add(EDR); //is there something like // EDRcell.text = "EDR"; ??? }
foreach (GridViewRow row in dataGridView1.Rows) { row.Cells[row.Cells.Count-1].Text = "EDR"; }
private void button1_Click(object sender, EventArgs e) { dataGridView1.Rows.AddCopies(0, 1); //row =0, no.of copies =1 }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)