Question

I'll try to keep this simple.

  • Small C# app, dialog based, one has a DataGridView.

  • I've got an UpdateTable function in the form that accepts a DataSet and passes it to the DataGridView.DataSource.  The DataGridView has columns defined already.

  • I've never used DataGridView and whatnot, so I was doing a bit of testing with it by passing it a DataSet I'd constructed myself.  Using this method gives me the correct number of rows, however the entries were all blank.

  • When I set the DataGridViewTextBoxColumn.DataPropertyName to the same as the column names in the DataSet, the entries show up.

  • If I remove the premade columns from the DataGridView, I get everything in the DataSet, but the columns are (obviously) unformatted in terms of size, and the column names are the names of the columns in the DataSet rather than easier to read / formatted names.

What's a good way to handle this in an MVP implementation, where the View doesn't have to know or worry about what columns will be in the DataSet it's being handed, but the column names can still be formatted properly in terms of size and name?  Should perhaps the Presenter pass in a vector of strings of DataPropertyNames, Column Names, and column sizes, so the View isn't cognizant of it?  

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top