How can i Hide/shows columns in datagridview runtime ?
I have a window application form with a comboBox and a grid.
As according to selection in comboBox Items, I want to hide or show
datagridview columns as according to combobox item selection

dataGridView1.Columns["column name\ index"].Visible = true\false;

Dear RamyMahrous
thanks for reply
i have tried the visible property. but my grid is binding grid[ i.e.datasouce] so last columns of grids has been visible false/true
but middle columns are not

so pls guide me. thanks again

Look I tried it myself, it works
I dragged and dropped a DataGridView control, I binded it a datasource, then I dragged and dropped a Button, on its ClickEvent handler I wrote this code

dataGridView1.Columns[2].Visible = false;

It removes this column == it works.
Or I don't understand you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.