VS2005 Autogenerated Code Overwrites my class code

K

Kerry

Hi, i'm having a strange issue, I've created a Class dervived from a
DataGridView that has all my columns, events properties etc defined. I take
this class and instanciate it on a Form. The problem is when I modify a
object on the parent form (say resize a button, change colors) the auto code
gernerator inserts its own code into the initialization section of the parent
to create the datagridview essentially duplicating all the columns and its
properties. How can I stop the code gererator from inserting its own code
for my datagridview, my class has everything already defined. Its really
annoying I have to delete all the code it throws in after every little change.
 
L

Lasse Vågsæther Karlsen

Kerry said:
Hi, i'm having a strange issue, I've created a Class dervived from a
DataGridView that has all my columns, events properties etc defined. I take
this class and instanciate it on a Form. The problem is when I modify a
object on the parent form (say resize a button, change colors) the auto code
gernerator inserts its own code into the initialization section of the parent
to create the datagridview essentially duplicating all the columns and its
properties. How can I stop the code gererator from inserting its own code
for my datagridview, my class has everything already defined. Its really
annoying I have to delete all the code it throws in after every little change.

You'll need to find a tutorial, book, article, whatnot on writing
components. It's not as easy as just plunking together a class. Well, it
is if you're instantiating it yourself, but once you let Visual Studio
have it, all sorts of magic happens.

You can control this magic, however, but you need to know how to do it.
I don't, but I do know there are excellent books out there on the subject.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top