How can I check if a DataGridView contains column “x” and column “x” is visible?

前端 未结 5 1472
耶瑟儿~
耶瑟儿~ 2021-01-11 10:13

How can I check if a DataGridView contains column \"x\" and column \"x\" is visible?

All I have so far is below.

if (Dgv.Columns.Contain         


        
5条回答
  •  粉色の甜心
    2021-01-11 10:49

    The straightforward method:

    if (dgv.Columns.Contains("Address") && dgv.Columns["Address"].Visible)
    {
        // do stuff
    }
    

提交回复
热议问题