IDE throwing an error when opening Form because of UserControl

joker77

Freshman
Joined
Sep 16, 2005
Messages
38
Location
Dublin
Hi there,

I have a Form, upon which I have a UserControl. The OnLoad event of the UserControl contains some code to load in values from an XML file.

In the IDE, when I open the Form, an error is thrown because when it's pulling in the UserControl the .Load is looking at a null value (in runtime it's fine because this value is set).

Is there anyway to get around this? It's not causing a problem, just an annoying error message comes up whenever I load the project into the IDE, or open the Form.
 
Not got VS handly at the moment so I could be wrong, but I seem to remember that anything inheriting from System.ComponentModel.Component (which should include controls) will have a DesignMode property - just check the value of that before trying to load the XML file.
 
Back
Top