I cannot easily modify the layout of a DataGridView created by dragging a data source (SQL Server table) to a Windows form of a desktop app. I would have expected the following to work:
1. Create Data Source and select a complete table from a DB (works just fine)
2. Drag it into a Windows form to create the DataGridView (works just fine including updating data etc)
3. Use the "Configure Data Source with Wizard" to deselect one column of the table
4. In the Form.cs[Design] window the table looks as expected, i.e. the deselected column has disappeared.
5. When I run the desktop app all the original columns are displayed except
that the deselected column is now empty of data. I have to delete the DataGridView and drag the data source to the form again to make it work as expected.
6. Now, however, if I add the column again in the Wizard, the re-added column will not re-appear, no matter what I try.
Removing/adding columns via the wizard is only the simplest form modification I will need to do. I will also want to modify the underlying SQL schema, e.g. reorder and remove columns, change the data type of a column. I'd be happy to delete the data source (by either deleting or excluding the DataSet.xsd file) and then adding the data source again. But that does not seem to work without significant manual clean-up of various files. And as I don't understand all the details such a clean-up easily could damage other parts of the app.
My workaround consists in making the mods in the database, creating a new project and recreate the data sources, and then copy and paste my own code from the old to the new project, not something feasible when the project keeps growing. And I was unable
to find anything helpful on the net
Any help/pointers are highly appreciated - thanks!