automatic code generation

  • Thread starter Thread starter wanderer
  • Start date Start date
W

wanderer

I'm not sure if this is the right forum, but it has to do
with the automatic code generation of a WinForm for the
Compact Framework.

Anyway, I thought I'd report an issue I've been having. I
subclass a control to define my own button class that can
draw custom images (since the CF does not permit this as
is). Anyway, to add it to my winForm, I manually add it
in among the automatically generated code, adding it to
the proper tab control, etc.
I build it, run it, and it works fine. Sometimes if I
then hide the automatically generated code (w/ my newly
added code interspersed) and proceed to edit the WinForm
through the GUI interface provided in VS .NET 2003 C#, at
some point, the code I intertwined w/ the automatically
generated code disappears.

I haven't nailed down the exact procedure that causes the
problem b/c each test I have to re-write the inter-mixed
code. Right now it isn't a big deal for me, but in the
future it might become an issue. I suspect that at some
point, the compiler may be re-generating the
automatically generated code but doesn't realize I've
edited it? Oh, and before it removes the code, an error
might pop up saying my class is uninitialized, but if I
build my project, it sees that it is initialized (among
the auto-gen code) and builds fine.
 
Indeed, a better place for your question would be:

microsoft.public.dotnet.framework.compactframework

Best wishes,

Neno Loje
Microsoft Student Partner
University of Hamburg
 
Hi,

Sounds like you put you code into InitializeComponent(). So it is very likely that your code will be overwritten by the form
designer sooner or later.
InitializeComponent() is called in the constructor of your form, so just move your code right below that call.
I hope that this so in the CF, too.

HTH, Ulrich.
 
Back
Top