I’m having some problems with the following:
- I want to get the first visible AND frozen column of a column collection.
I think this will do it:
DataGridViewColumnCollection dgv = myDataGridView.Columns; dgv.GetFirstColumn( DataGridViewElementStates.Visible | DataGridViewElementStates.Frozen);
- Is it also possible to make a bitmask to get the first frozen OR visible column?
The implementation is, AFAIK, ‘all of these’ – it uses:
Which is ‘all of’. If you wanted to write an ‘any of’, perhaps add a helper method: (add the ‘this’ before
DataGridViewColumnCollectionto make it a C# 3.0 extension method in)Or with LINQ: