Sunday, June 6, 2021

[VB.net][Resolved] hide column from data grid view

 Suppose the name of dataGridView is "dgv1" and you want to hide column "age":

if(dgv1.Columns.Contains("age")){

  dgv1.Columns("age").Visible = False

}


Reference:

https://docs.microsoft.com/en-us/dotnet/desktop/winforms/controls/how-to-hide-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8

https://stackoverflow.com/questions/12836064/how-to-check-if-column-exists-in-a-datagridview

No comments :

Post a Comment