How to bind hardcoded DataGridView with DataTable
-
I have one DataTable and one datagridview. Both are hardcoded. DataTable has been populated and now i want to bind this with DataGridView. DGV.DataSource = datatable; Above code is not working. This code is not giving any error but this code is not populating datagridview. Is there any property for binding Hardcoded DGV. Thanx in Advance.....
-
I have one DataTable and one datagridview. Both are hardcoded. DataTable has been populated and now i want to bind this with DataGridView. DGV.DataSource = datatable; Above code is not working. This code is not giving any error but this code is not populating datagridview. Is there any property for binding Hardcoded DGV. Thanx in Advance.....
// Set up the DataGridView.
dataGridView1.Dock = DockStyle.Fill;// Automatically generate the DataGridView columns. dataGridView1.AutoGenerateColumns = true; // Set up the data source. bindingSource1.DataSource = GetData("Select \* From Products"); dataGridView1.DataSource = bindingSource1; // Automatically resize the visible rows. dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders; // Set the DataGridView control's border. dataGridView1.BorderStyle = BorderStyle.Fixed3D; // Put the cells in edit mode when user enters them. dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;
Ahsan Ullah Senior Software Engineer