Im trying to delete 2 checkbox columns from datagridview because Im trying to update data, so basically I need a way to delete those columns (Im dropping all columns besides those 2 and putting a new datatable with updated data from database) or to Update columns when a button "save" is pressed.
To better explane the problem, here are some screenshots:
Before pressing "save":
My idea of updating datagridview:
NpgsqlDataAdapter da = new NpgsqlDataAdapter(command_odjel_id);
dt = new DataTable();
da.Fill(dt);
Radni_sati_tablica.DataSource = dt;
After that I add those 2 checkbox columns ( there is a query for filling those checkboxes but thats irelevant for this question):
DataGridViewCheckBoxColumn bolovanje = new DataGridViewCheckBoxColumn();
bolovanje.HeaderText = "Bolovanje";
bolovanje.Width = 30;
Radni_sati_tablica.Columns.Insert(0, bolovanje);
DataGridViewCheckBoxColumn godisnji = new DataGridViewCheckBoxColumn();
godisnji.HeaderText = "Godisnji";
godisnji.Width = 30;
Radni_sati_tablica.Columns.Insert(1, godisnji);
After that I do Update with the query and I finish with:
Radni_sati_tablica.DataSource=null;
Radni_sati_tablica.DataSource = dt;
Radni_sati_tablica.Update();
Basically all I need is to update table with new data that has been inputed, I just need a way to do it.


DatagridView.AutoGenerateColumns = false. But without the code - how you load data, update data it is difficult to answerDataGridView- instead create and add columns to theDataTable- then when you set newDataTableto theDataGridView.DataSourcemanually added columns will be gone.