I am programmatically creating a DataGridView object and then binding it to a DataTable using the grid's DataSource property.
After creating the grid, I am adding it to a WinForms's control collection, ie:
Form1.Controls.Add(grid);
I want to apply formatting to the grid (i.e. change column header captions etc.) before passing it to the Forms.Controls collection. The problem is that the DataGridView's Rows and Columns are not created until it is added to the form.
Is there a way to force the DataGridView to create the rows and columns?
I could probably set DataGridView.Visible = false, add the grid to the form, format the grid, and then set DataGridView.Visible = true...HOWEVER, I really need to do all my formatting BEFORE I add it to the form's control collection. Any ideas?