473,403 Members | 2,293 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,403 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 1700
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.