Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2007

Tip: Looking for answers? Try searching our database.

Visual C 2005 Removing Event Handlers When Designer Reloading

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gnassar@gmail.com - 07 Jun 2007 20:35 GMT
Essentially my problem is that .NET 2005 is removing my event
handlers. There's no real special things about my project, it just
continually removes them all.

It starts on the open of a solution. The screen flashes and
immediately I can undo something. I look at the undo list and it says
designer generated code. When I undo it, all of my event handlers come
back. This is a very annoying issue  has anyone solved this problem?

-G
Ben Voigt [C++ MVP] - 07 Jun 2007 20:52 GMT
> Essentially my problem is that .NET 2005 is removing my event
> handlers. There's no real special things about my project, it just
[quoted text clipped - 4 lines]
> designer generated code. When I undo it, all of my event handlers come
> back. This is a very annoying issue  has anyone solved this problem?

Perhaps put the wire-up code in the constructor, not in InitializeComponent
that the designer messes with.
gnassar@gmail.com - 08 Jun 2007 19:44 GMT
That doesn't make sense.

I'm not placing code in myself to begin with. When I add a windows
form component, and then choose the events button in the GUI, then
double click say: OnLoad the gui creates a function for me at the end
of the document called OnLoad. On top of that it places a handler in
the generated code itself in the designer generated code mapping this
control to the handler. What you're asking, or suggesting is that I
not only insert handlers using the GUI but then go back and place them
outside of the generated code.

I think that you may have misunderstood me. I'm not editing that area.
I'm not touching it. Anything that should be there should be placed by
the IDE itself.  The problem is that the IDE is removing my handlers
itself after I reopen a project.

Note that it does not delete the functions it just removes the maps to
them.

Gus

> <gnas...@gmail.com> wrote in message
>
[quoted text clipped - 11 lines]
> Perhaps put the wire-up code in the constructor, not in InitializeComponent
> that the designer messes with.
Ben Voigt [C++ MVP] - 08 Jun 2007 22:20 GMT
> That doesn't make sense.
>
[quoted text clipped - 11 lines]
> the IDE itself.  The problem is that the IDE is removing my handlers
> itself after I reopen a project.

I thought you asked for a simple workaround, so I offered one.  Go again and
file bug reports, but designer support for C++/CLI will quite possibly go
away entirely (it's far more complicated to support than any other
language).  C++/CLI is positioned as a gateway, from .NET to any non-.NET
system, it does this well and most MVPs are encouraging MS to focus efforts
on C++ with CLR toward making that even better.  Since it's so easy to mix
C# and C++ code, and any C++ programmer can immediately use C# quite well,
the brunt of design-time GUI support is always going to be focused on C# and
VB.NET

The only advantages C++ has over C# for GUIs, are things like template
metaprogramming, which are far too sophisticated to hope the designer would
ever help with.

> Note that it does not delete the functions it just removes the maps to
> them.
>
> Gus
gnassar@gmail.com - 11 Jun 2007 21:59 GMT
> <gnas...@gmail.com> wrote in message
>
[quoted text clipped - 34 lines]
>
> > Gus

My apologies if I seemed rash. Thanks for the workaround, I just am
annoyed that I may have to do this for every future project I have to
do.

Gus
Ben Voigt [C++ MVP] - 12 Jun 2007 06:32 GMT
>> <gnas...@gmail.com> wrote in message
>>
[quoted text clipped - 44 lines]
> annoyed that I may have to do this for every future project I have to
> do.

If I might suggest -- if you want good designers, use C# for the GUI and add
your C++/CLI projects as assembly references.

Can you check whether Orcas also exhibits this problem?  It's unlikely that
any C++/CLI designer improvements will be made post Orcas.

> Gus

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.