473,388 Members | 981 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,388 software developers and data experts.

Design mode frustration -- deleting code

A quick rant and a question.

Why does the designer in VS2003 delete code about custom components that it
can't load? I've had large sections of forms disappear in the blink of an
eye just because I've introduced a small error in a widely used custom
control that makes it throw an exception at design time.

IMHO the code should be sacrosanct -- if the designer can't create some sub
control then it should just throw up a blank or a red X or something (it
would be nice if it would be smart enough to figure out where the control is
supposed to be and just mark that area) and make note of the exception. Is
there some way to stop the designer from deleteing code (aside from marking
the code read only before entering the designer, which is what I've started
doing)? Is this going to change any time soon?

Thanks,
Eric

PS This is in Visual C#, from some things I have read it behaves
differently in Visual Basic but I haven't tried that.
Nov 16 '05 #1
3 1699
It does say you shouldn't edit code in there - the designer can delete and
destroy anything it finds. From experience, it's better either doing your
own code outside the designer created code or at least keeping a copy of the
function before you go into the designer. I agree it's really irritating,
but it can be avoided (or at least made less destructive).

Steve

"Eric Hudson" <Er********@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
A quick rant and a question.

Why does the designer in VS2003 delete code about custom components that it can't load? I've had large sections of forms disappear in the blink of an
eye just because I've introduced a small error in a widely used custom
control that makes it throw an exception at design time.

IMHO the code should be sacrosanct -- if the designer can't create some sub control then it should just throw up a blank or a red X or something (it
would be nice if it would be smart enough to figure out where the control is supposed to be and just mark that area) and make note of the exception. Is there some way to stop the designer from deleteing code (aside from marking the code read only before entering the designer, which is what I've started doing)? Is this going to change any time soon?

Thanks,
Eric

PS This is in Visual C#, from some things I have read it behaves
differently in Visual Basic but I haven't tried that.

Nov 16 '05 #2
LOL. Its not fussy about whose code it deletes. It will delete its own
designer generated code just as easily.

Cheers

Doug Forster

"Steve McLellan" <sjm.NOSPAM AT fixerlabs DOT com> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
It does say you shouldn't edit code in there - the designer can delete and
destroy anything it finds. From experience, it's better either doing your
own code outside the designer created code or at least keeping a copy of
the
function before you go into the designer. I agree it's really irritating,
but it can be avoided (or at least made less destructive).

Steve

"Eric Hudson" <Er********@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
A quick rant and a question.

Why does the designer in VS2003 delete code about custom components that

it
can't load? I've had large sections of forms disappear in the blink of
an
eye just because I've introduced a small error in a widely used custom
control that makes it throw an exception at design time.

IMHO the code should be sacrosanct -- if the designer can't create some

sub
control then it should just throw up a blank or a red X or something (it
would be nice if it would be smart enough to figure out where the control

is
supposed to be and just mark that area) and make note of the exception.

Is
there some way to stop the designer from deleteing code (aside from

marking
the code read only before entering the designer, which is what I've

started
doing)? Is this going to change any time soon?

Thanks,
Eric

PS This is in Visual C#, from some things I have read it behaves
differently in Visual Basic but I haven't tried that.


Nov 16 '05 #3
I guess I wasn't clear. It is deleting its own code. Here is a simple
scenario.

1) Make a custom control
2) Make a form and drop that control on it
3) Now "break" the custom control -- put something that throws an exception
in the constructor (as a trypical example I occasionally forget to hide
references to objects that are null in design mode as they get initialized at
run time)
4) Go back to the form in design mode. It will destroy all the code about
the custom control -- where it was, any initialization information.

This is stupid. One control on one form isn't too bad. But I might have 50
data entry controls on some form and if I break that control it deletes all
of them. This is obviously painful to recreate and there is just no good
reason for it as far as I can tell. If it runs into trouble why can't it
just paint the area with an error marker of some sort?

"Steve McLellan" wrote:
It does say you shouldn't edit code in there - the designer can delete and
destroy anything it finds. From experience, it's better either doing your
own code outside the designer created code or at least keeping a copy of the
function before you go into the designer. I agree it's really irritating,
but it can be avoided (or at least made less destructive).

Steve

"Eric Hudson" <Er********@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
A quick rant and a question.

Why does the designer in VS2003 delete code about custom components that

it
can't load? I've had large sections of forms disappear in the blink of an
eye just because I've introduced a small error in a widely used custom
control that makes it throw an exception at design time.

IMHO the code should be sacrosanct -- if the designer can't create some

sub
control then it should just throw up a blank or a red X or something (it
would be nice if it would be smart enough to figure out where the control

is
supposed to be and just mark that area) and make note of the exception.

Is
there some way to stop the designer from deleteing code (aside from

marking
the code read only before entering the designer, which is what I've

started
doing)? Is this going to change any time soon?

Thanks,
Eric

PS This is in Visual C#, from some things I have read it behaves
differently in Visual Basic but I haven't tried that.


Nov 16 '05 #4

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

Similar topics

10
by: BlueDolphin | last post by:
I'm not sure if this is a question or more of a rant... but I'm looking for some input on this from other developers out there. How often has the following happened to you and how have you dealt...
4
by: jim | last post by:
I am trying to debug a user written web control and web control designer. I found an article “Building Windows Forms Controls and Component with Rich Design-Time Features” that describes how...
4
by: JJ | last post by:
Hi, Ok I was reading an old ASP 3.0 Book and I noticed that when designing web applications. Everything that us windows form and vb programmers would do was to put all functions relating to a...
5
by: Don | last post by:
Is there a way to capture click events in the form designer? I'm trying to create a control similar to the TabControl (which seems to handle clicks in design mode) and would like to be able to...
9
by: Reidar | last post by:
Is it possible to have the source in one window and the design in another window and perhaps the code in a third window? reidarT
3
by: Rolf Welskes | last post by:
Hello, for a large web site project we would like to use nested Master Pages. Unfortunely VS2005 is not able to show pages in design mode when nested Master pages are used. This has the...
2
by: TerryStone | last post by:
I have created a control that displays a list of items. During design mode I fill it with junk data using calls from the constructor. So when I look at a form with the control on, instead of...
3
weaknessforcats
by: weaknessforcats | last post by:
Design Pattern: The Singleton Overview Use the Singleton Design Pattern when you want to have only one instance of a class. This single instance must have a single global point of access. That...
0
by: diane | last post by:
I have multiple multi-user databases with both the front and back ends residing on my network. Each user has his/her own front end mdb, all of which point to a central backend mdb. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.