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 / WinForm General / April 2006

Tip: Looking for answers? Try searching our database.

Adding a User Control closes VS.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joelcochran@gmail.com - 26 Apr 2006 20:36 GMT
I am running VS.NET 2005.  I have created a UserControl and added it to
my toolbox.  When I try to drag it onto a Form, Visual Studio closes
immediately with no reported errors.

I've added the UC to a new solution, I have the project in the
solution, and am referencing the Project output in the Form.  Where can
I go from here?

Thanks,

Joel
Stoitcho Goutsev (100) - 26 Apr 2006 20:57 GMT
Joel,

With VS 2005 this happens sometimes when something throws an unahndled
exception when the control is in the designer. Attach a debugger to break on
the place where exceptions are thrown.

Signature

HTH
Stoitcho Goutsev (100)

>I am running VS.NET 2005.  I have created a UserControl and added it to
> my toolbox.  When I try to drag it onto a Form, Visual Studio closes
[quoted text clipped - 7 lines]
>
> Joel
joelcochran@gmail.com - 27 Apr 2006 14:28 GMT
Actually, I solved the problem last night: I was referencing the UC
type instead of the actual instance in a Property:

public MapConfig MapConfig
       {
           get { return this.MapConfig; }
           set
           {
               this.resetControl();
               this.MapConfig = value;
               if (this.MapConfig != null)
               {
     // etc

SHOULD have been:
public MapConfig MapConfig
       {
           get { return this.config; }
           set
           {
               this.resetControl();
               this.config = value;
               if (this.config != null)
               {

Thanks for the response though!

I am confused about two things though: first of all, why would this
even compile?  Second of all, why would it cause VS to shut down?

Joel
Marc Gravell - 27 Apr 2006 14:37 GMT
Well, the second would be because of the infinite loop while trying to read
(or write) your control's values...
It copes with exceptions OK (message-boxing them), but this? tricky...

The first would be because it isn't illegal? Very inadvisable, definately,
but not illegal. There should maybe (as a suggestion for a tweak) be a
recursion warning about properties invoking themselves, though - i.e. the
setter calling the same setter on the "this" instance (or similar with
static); that might be a nice feature...

Marc
Marc Gravell - 27 Apr 2006 14:39 GMT
ar right, /now/ I see your question about not compiling; you /weren't/ using
the UC type; you were referencing the MapConfig property on the current
instance. In this scenario, you can get at the UC type only by using more of
the namespace.

Marc

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.