Answer the question
In order to leave comments, you need to log in
How to check if a column exists in a DataGridView?
How to set condition in datagridview c# if column exists then make it invisible?
Let's say I have a column Column1. If it is present, it will become invisible. And if it is not, there will be
an error. How to make a check for its presence and, if it is present, make it invisible?
dataGridView1.Columns["Column1"].Visible = false;
Answer the question
In order to leave comments, you need to log in
if(dataGridView.Columns.Contains("Column1"))
dataGridView.Columns["Column1"]. Visible = false;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question