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 / Windows Forms / Design Time / April 2004

Tip: Looking for answers? Try searching our database.

controls being deleted in design time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michiel Doeven - 08 Apr 2004 22:11 GMT
Hello

I have the following problem. When I'm designing controls and use them, Visual Studio tends to delete controls randomly
I think this is because my user control uses data-adapters, etc. which will result in an error during design time. The result is that Visual Studio deletes this control, because it doesn't work or something like this. This results in a null-reference-exception, which is correct because my control is gone (the "Protected UserControl1 As UserControl" is the only thing remaining)

Is there a way, tha't disables the power of the design time functions. In design time Visual Studio can delete and create controls, bur I want that the design time cannot delete user controls that maybe in design time create an exception (which only is "?"), but work when running the app. Now I have to backup the information in the Sub InitializeComponents to restore it if the design time is deleting controls

I have found on internet and in my own experience that if you don't open the design view, that problem not occurs. However, sometimes I want to open it to make changes. The design time then deletes some of my user controls

Thanks for any help

Regards

Michiel Doeven
"Ying-Shen Yu[MSFT]" - 09 Apr 2004 08:41 GMT
Hi Michiel,

I'm afraid we can prevent Visual Studio from deleting a user control by
throwing an exception in design-time. In fact, base on my knowledge the
unexpected deletion of usercontrol is caused by an internal unhandled
exception in the method/property of the user control. So I think  it's
better to debug your user control in design-time and try catching the first
chance exception to make clear what caused the internal exception. The
technical article below will show you how to debug a design-time control.
You need also enable the "first-chance"exception in the Exception Dialog in
IDE.

If you have trouble to analyze the exception, please give me more
information about the problem and the exception, I'll follow up with you on
this issue.

Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
"Ying-Shen Yu[MSFT]" - 09 Apr 2004 08:43 GMT
Sorry, forgot to add the link in last post.

<Debugging Design-Time Controls>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/
html/DesignTimeDebugging.asp

Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
Michiel Doeven - 15 Apr 2004 13:37 GMT
Thanks for your help. I solved the problem with the
property "Designmode" as mentioned in the link.

Every part of code that can be called in designtime that
could raise an exception is now checked with the property
Designmode. And because the property doesn't work in the
constructor (as stated in the link) I moved all code that
could cause a problem to the Load-event (and then checked
Designmode).

The exception I usually got was only "?". Nothing more.

So thanks for your help,

Best Regards,

Michiel Doeven

>-----Original Message-----
>
[quoted text clipped - 15 lines]
>
>.

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.