DGV Auto Create...

JaedenRuiner

Well-known member
Joined
Aug 13, 2007
Messages
340
Programming Experience
10+
Alright, this may be better in DataAccess, but I'm not really asking about the Data Side of it, but the Graphical, windows 'Forms' creation side of the control.

Anyway, the DGV has the Ability to AutoGenerateColumns, which it annoyingly always resets, but that is easily resolved. However, Some of the Columns in my DataSets and DataTables (yadda, yadda, yadda) are actually foreign key columns, and for visual representation I prefer having those Columns Represented as a ComboBox style, with the DisplayMember and ValueMembers set accordingly per table.

As I am doing a lot of my binding assignments at run time, I was curious about the generation of those columns.

If I set AutoGenerateColumns = True, can I affect the creation of those columns a run time based upon specific parameters?

Like, for example, the DataPropertyName. I know that every DataPropertyName in my application which equates to "Customers" is based on the Customers Table and I want that Column to be a DGV ComboBox type of column, with X Data Source and Y/Z Display/Value members.
These set ups happen two or three times throughout the form, but instead of having 25 DGVs all willy nilly, i prefer to set the DataSource/Datamember of the DGV to a different BindSource at Run Time.

Is this in anyway possible?
(i tried to look at it myself, but the e.column property in the ColumnAdded() event is readonly)
Thanks
 
Back
Top