I'm using a windows form with a designer generated DataGridView (so it generated all it's code to layout the form). I need to support dynamic columns on the control (which is easy to do by selecting the columns you want in the columns property). My question is how do I get my code to come into play before the form is displayed and layed out In escense I want my code (attaching the columns) to be inserted in the middle of of the code that the designer generated.
Thanks

Generating dynamic columns on a designer generated DataGridView control
Milo145
Steven Zhao
Thanks for replying. By dynamic I mean that it's user configurable. The user perviously defines which columns he wants in his view and then when this form comes up, it displays these preconfigured columns in the datagridview.
What I want is to use this previously configure column information and create the column array my self from the configuration data (I know how to do that) but then set the columns.Addrange from my columns array. This is what the designer does (for a fixed set of columns) in the middle of the generated code:
this
.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.nameDataGridViewTextBoxColumn, this.rangeDataGridViewTextBoxColumn, this.valueDataGridViewTextBoxColumn, this.enabledDataGridViewCheckBoxColumn});But instead of using those fixed set of columns, I want to set my own array of columns that were previously generated.
The alternative that I'm trying to avoid, is that I could just hard code the entire form and not use the designer, but I figure there has got to be a way to use the designer and also use my columns array.
Thanks