473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Visual C 2005 Removing Event Handlers When Designer Reloading

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

Jun 7 '07 #1
5 1791

<gn*****@gmail.comwrote in message
news:11**********************@h2g2000hsg.googlegro ups.com...
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?
Perhaps put the wire-up code in the constructor, not in InitializeComponent
that the designer messes with.
Jun 7 '07 #2
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

On Jun 7, 3:52 pm, "Ben Voigt [C++ MVP]" <r...@nospam.nospamwrote:
<gnas...@gmail.comwrote in message

news:11**********************@h2g2000hsg.googlegro ups.com...
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?

Perhaps put the wire-up code in the constructor, not in InitializeComponent
that the designer messes with.

Jun 8 '07 #3

<gn*****@gmail.comwrote in message
news:11*********************@h2g2000hsg.googlegrou ps.com...
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.
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

Jun 8 '07 #4
On Jun 8, 5:20 pm, "Ben Voigt [C++ MVP]" <r...@nospam.nospamwrote:
<gnas...@gmail.comwrote in message

news:11*********************@h2g2000hsg.googlegrou ps.com...
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.

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
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

Jun 11 '07 #5

<gn*****@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
On Jun 8, 5:20 pm, "Ben Voigt [C++ MVP]" <r...@nospam.nospamwrote:
><gnas...@gmail.comwrote in message

news:11*********************@h2g2000hsg.googlegro ups.com...
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.

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

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.
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
Jun 12 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
Hi everyone, I am having a tinker around with Visual Studio Professional 2005 and I am building a simple website: Now, in 1.1 the event handlers were declared in the code behind page and you...
3
by: Dino Buljubasic | last post by:
Hi, I am thinking of using visual inheritance. I am using C# VS 2005. I am concerned about how good it is. I have heard about problems like controls dissapearing or so. Any hints, tips,...
5
by: jrett | last post by:
I'm working on a windows forms application and some of my controls have multiple event handlers assigned to them. I haven't figured out how to add multiple event handlers via the properties...
6
by: Jake K | last post by:
Where is the best place to define event handlers? I need to define event handlers for a COM object referenced in my project and am doing so in the fowm load. Is this the best place?
8
by: WT | last post by:
Is it normal that Visual Studio sets the PreInit handler for a Page from the OnInit code ? No chance to fire it as OnPreInit is run befor OnInit. ??? CS
7
by: Dom | last post by:
In CSharp, can you have multiple handlers for a single event? For example, for a textbox TextChanged event, can I have two separate handlers called up? I have 4 text boxes, and the TextChanged...
4
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. -...
9
by: Just Me | last post by:
Hi, Im fairly new to 2005 and I was wondering. In 2003, when you add a button, it also adds and AddHandler statement within the initialisation routine to wire up the handler to the event. ...
0
by: khalid galal | last post by:
Hi, i am having a problem with removing event handlers, it is when creating nested event handlers (an event handler raising another event handler) where a part of the code is private void...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.