﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Issues  » Exception when setting RequiredFields</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 07 May 2026 11:44:03 GMT</lastBuildDate><ttl>20</ttl><item><title>Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1523.aspx</link><description>I'm getting the following error for one of my BO's when I try to set the RequiredFields property:&lt;/P&gt;&lt;P&gt;"An error occurred while attempting to load this type editor:&lt;BR&gt;Exception has been thrown by the target of an invocation."&lt;/P&gt;&lt;P&gt;I can map it without error&amp;nbsp;through the BO Mapper and I have created several other BO's without problems.&amp;nbsp; What could cause something like this?</description><pubDate>Wed, 14 Jun 2006 13:31:01 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1544.aspx</link><description>Andria,&lt;/P&gt;&lt;P&gt;I forgot to mention that if you ever want to test on some code that should on run at design-time, you can use the ReadOnly DesignMode property, like this:&lt;/P&gt;&lt;P&gt;If Me.DesignMode Then&lt;/P&gt;&lt;P&gt;'-- Code that should only run at design-time&lt;/P&gt;&lt;P&gt;End If&lt;/P&gt;&lt;P&gt;Unfortunately, this won't help you in this case, because the DesignMode property will always return False (because it isn't set) until after the constructor exits.&amp;nbsp; So, once an object has been instantiated, you can test on the property, but until it has been set, you cannot use it.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Oh, and the property is Protected, so you can only access it within the object (unless you wrap it in a public property).</description><pubDate>Wed, 14 Jun 2006 13:31:01 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1542.aspx</link><description>OK, that makes sense.&amp;nbsp; I can figure something else out to accomplish this.&amp;nbsp; A factory method will probably be a good way for me to go.&amp;nbsp; Thanks for the help!</description><pubDate>Wed, 14 Jun 2006 10:56:23 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1540.aspx</link><description>The reason it's throwing an exception is that you're filling the business object within the constructor.&amp;nbsp; When you are in the designer, all code within the constructor is executed at design-time because the designer creates instances of the objects at design-time.&amp;nbsp; When your objects are created, they're trying to fill themselves, and since the DataSource("") is the data source being used by StrataFrame, it cannot find your tables, and therefore cannot fill the business object at design-time.&amp;nbsp; Your best solution is to remove the FillDataTable method from the constructor and do one of two things: 1) Create a Shared "factory" method that will create new instances of the business objects and fill them before returning their references, or 2) Just manually call the FillDataTable method after the object is created.</description><pubDate>Wed, 14 Jun 2006 10:42:36 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1537.aspx</link><description>It compiles fine and I even used it as a reference in another project.&amp;nbsp; I just can't get to the required fields.&amp;nbsp; I'm having the issue only with one other BO at this time.&amp;nbsp; I'm attaching the projects I'm having problems with and maybe you can tell me if I've done something wrong.&amp;nbsp; I followed the same steps I've taken to create a lot of other BOs, but these don't seem to work like the rest.</description><pubDate>Wed, 14 Jun 2006 10:03:31 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1532.aspx</link><description>Are there any compiler errors within the project, or does it build properly?&lt;/P&gt;&lt;P&gt;Are you getting the same error within other business objects, or just that one business object.&lt;/P&gt;&lt;P&gt;If it is localized to a single business object, can you post the main code file and the designer file for the business object here on the forum (or email it to me) so I can step through it and see if we can track down the problem?</description><pubDate>Wed, 14 Jun 2006 09:27:08 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1528.aspx</link><description>Any suggestions on getting past this problem???&amp;nbsp; I'm kind of stuck working and can't go forward.</description><pubDate>Tue, 13 Jun 2006 17:02:10 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1527.aspx</link><description>I rebuilt and still had the same error, then closed all of VS and came back.&amp;nbsp; Still the same error.&amp;nbsp; Anything else that could cause this?</description><pubDate>Tue, 13 Jun 2006 14:34:48 GMT</pubDate><dc:creator>Andria Jensen</dc:creator></item><item><title>RE: Exception when setting RequiredFields</title><link>http://forum.strataframe.net/FindPost1524.aspx</link><description>Andria,&lt;/P&gt;&lt;P&gt;Rebuild your solution (not just build) and if you still get the error, get out of Visual Studio and come back in and see if the error persists.&amp;nbsp; Most times this is due to VS trying to hold on to an assembly.</description><pubDate>Tue, 13 Jun 2006 14:25:47 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item></channel></rss>