简体   繁体   中英

DataGridView in windows 10 shows columns that have visible set to false programatically

I am wondering if anyone has come across an issue with Windows 10 (using the Enterprise edition) in which an application all of a sudden is showing all columns in a standard datagridview even though the columns have visible set to false in the code behind. This application works fine and has been in production now for over a year, and is running on windows 7, 8 and 8.1 without any issues. The moment it was placed on the 10 machine, it worked, but the datagridviews are showing all columns!

I have set the compatibility to both 7 and 8 but it still has the same behavior.

The code has not changed in a year.

I have googled for this error and have come up with nothing so far.

So has anyone else had this issue?

The application is using the 4.5 framework and is a windows form application.

The code is very straight forward for this:

dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
dataGridView1.Columns[0].Visible = false;
dataGridView1.Columns[4].Visible = false;

So again, nothing has changed except for the machine being tested on.

Any ideas?

Thanks!

The following worked for me.

  1. Moved the hidden column to the end of the columns list in the designer.
  2. Programatically setting the datagridview.coulumns[datagridcolumnd.name].visible = false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM