Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio adds columns to DataGridView after running program

I have a datagridview that is linked to a three columns in the database, and it's only displaying them (no editing). When I run the program in debug, and exit, when I return to the form in Visual Studio, it has my three columns, plus all the columns in the table it's linked to. If I don't remove these, the next time I run the program, they show up on the form. If I remove them, I have to do it every time I run the program.

Any ideas on how to fix this?

like image 863
Malfist Avatar asked Dec 23 '22 12:12

Malfist


1 Answers

According to this there is a bug in Visual Studio that requires you to set the binding source to none/null before changing it (It seems to have been around since 2005). I removed all the columns, set binding source to none, then reset the binding source to what I wanted and edited the columns. It is working now.

like image 73
Malfist Avatar answered Dec 31 '22 14:12

Malfist