Hiding default gray column in datagridview winform

前端 未结 6 1359
终归单人心
终归单人心 2020-12-01 04:02

Is there any way to remove or hide winform\'s datagrid gray area when data is not avaiable?

Second this how to remove/hide the default gray column?

          


        
6条回答
  •  情歌与酒
    2020-12-01 04:57

    If you are trying to delete grid view column in column level and its not being reflected in grid view please follow as below: We can't delete the column of grid view in column level. So, delete the column's cell in row level (means in each and every row).

    foreach (GridViewRow Row in this.searchResults.SearchResultGrid.Rows)
                        {
                            if (Row.RowType == DataControlRowType.DataRow)
                            {
                                Row.Cells[0].Visible = false;
                            }
                        }
                        GridViewRow HeaderRow = this.searchResults.SearchResultGrid.HeaderRow;
                        HeaderRow.Cells[0].Visible = false;
    

提交回复
热议问题