Reputation: 1618
There is DataGrid (WinForms / .NET CF 3.5) bounded with DataSource to list object. How to disable data editing in cells?
Upvotes: 1
Views: 927
Reputation: 177
Try this,
dt.Columns(0).ReadOnly = True '// Make the column(0) readonly and assign to DataGrid.
dataGridView1.DataSource = dt
This code can make any column you set as read only. By the way,
dt
represents as datatable that is used to gather data from database and its datasource to the datagrid dataGridView1.
Upvotes: 1
Reputation: 644
You can try using DataGridView instead of DataGrid and set it's EditMode property to EditProgrammatically
dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
Upvotes: 0