c# - Inherits from DataGridView with custom properties -


i've written own grid inherits datagridview class , has custom properties , columns.

like :

public class foo : datagridview {      private system.windows.forms.datagridviewtextboxcolumn c1;      public foo() {         initializeclass();     }      void initializeclass() {        this.autogeneratecolumns = false;       c1 = new datagridviewtextboxcolumn();       this.c1.datapropertyname = "c1";       this.c1.headertext = "column 1";       this.c1.name = "c1";    }   } 

the program runs well, visual studio creating mess code! in initializecomponent() vistual studio creates again datagridviewcolumns properties :s

is there way avoid behavior.

thnks!

update : autogeneratecolumns set false

you either create columns @ runtime, think checking system.componentmodel.licensemanager.usagemode works, or hide columns property designerserializationvisibility attribute.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -