﻿<?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 » Business Objects and Data Access (How do I?)  » Error Message opening up form 'The DataSourceKey [NET] is not defined</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 09:34:54 GMT</lastBuildDate><ttl>20</ttl><item><title>Error Message opening up form 'The DataSourceKey [NET] is not defined</title><link>http://forum.strataframe.net/FindPost11357.aspx</link><description>I have had my SF application running for a while&amp;nbsp; now and I've had no problem in the past opening up a form in Visual Studio, but for some reason today I have been getting a lot of weird problems, such as the above error, on a form which I have opened and closed without problems earlier today. Nothing has changed in the Business Object side, I am just changing the UI. "NET" is my datasource key for one of my databases. &lt;/P&gt;&lt;P&gt;I have also had problems with my forms that use a SharedDataTableKey.&amp;nbsp; All of a sudden I can't open these forms because the sharedDataTableKey is not defined.&lt;/P&gt;&lt;P&gt;Any idea's why this is happening and how to resolve?&amp;nbsp; I have tried cleaning and rebuilding my solution but it didn't help.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tim</description><pubDate>Fri, 07 Sep 2007 09:39:13 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: Error Message opening up form 'The DataSourceKey [NET] is not defined</title><link>http://forum.strataframe.net/FindPost11378.aspx</link><description>It might be reflecting properly, but the Me.DesignMode will never work within the constructor (or any constructor for that matter, I think), because the value of the control/parent object is never set until after the control is created.&amp;nbsp; That's why I recommended moving the code to the OnCreateControl() method because it's the first thing that get called after the constructor/InitializeComponent().&amp;nbsp; We figured this one out the hard way... several days of trying to determine whether we were at design-time because we thought the DesignMode property was broken.&lt;/P&gt;&lt;P&gt;But, if none of your calls are in the constructor/InitializeComponent(), then it very well could be that nesting user controls confuses the DesignMode property.&amp;nbsp; I haven't actually tried this.&lt;/P&gt;&lt;P&gt;And don't worry about nesting UserControls... it's actually good practice :)&amp;nbsp; Any time you can re-use code is a good thing (without copying it ;)).</description><pubDate>Fri, 07 Sep 2007 09:39:13 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Error Message opening up form 'The DataSourceKey [NET] is not defined</title><link>http://forum.strataframe.net/FindPost11377.aspx</link><description>Okay, I spent the majority of the day troubleshooting this problem and believe I have found the&amp;nbsp;source.&amp;nbsp; &lt;/P&gt;&lt;P&gt;I have a form that contains a UserControl. This UserControl has a few different sections which are also UserControls and those UserControls&amp;nbsp;also contain another user control. (I only did this because this particular display is used on&amp;nbsp;various forms).&amp;nbsp;&amp;nbsp; It appears that if you go deeper that two user controls the &lt;STRONG&gt;me.DesignMode&lt;/STRONG&gt; is no longer recognized.&amp;nbsp;When I commented out this code the form loaded properly.&amp;nbsp;</description><pubDate>Thu, 06 Sep 2007 22:26:40 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: Error Message opening up form 'The DataSourceKey [NET] is not defined</title><link>http://forum.strataframe.net/FindPost11375.aspx</link><description>Are there any files in the GAC, on disk, etc. that may be getting loaded rahter than was is reflected in your source code?&amp;nbsp; I have seen that happen as well which can wreak havoc on your patience :D&amp;nbsp;Also, if your assembly gets loaded in the GAC, you must get out of Visual Studio and come back AFTER you build before the new changes take effect.</description><pubDate>Thu, 06 Sep 2007 14:22:35 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Error Message opening up form 'The DataSourceKey [NET] is not defined</title><link>http://forum.strataframe.net/FindPost11369.aspx</link><description>Thanks Ben.&amp;nbsp; Is there anyway to determine the line of code this is happening or perhaps doing a trace. It's very strange because I took a backup before I started making changes and the backup copy displays fine, and when I undo pending changes and compare the two programs they are identical... very strange.</description><pubDate>Thu, 06 Sep 2007 10:41:08 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: Error Message opening up form 'The DataSourceKey [NET] is not defined</title><link>http://forum.strataframe.net/FindPost11365.aspx</link><description>The business objects won't try to access the database by themselves.&amp;nbsp; Most likely, there is a call to a fill method somewhere in a form constructor (or another place that gets called at design-time, like OnCreateComponent).&amp;nbsp; If you try to fill a business object at design-time, it will try to create its DataLayer, which will try to access the data source.&amp;nbsp; So, on the form in question, check the constructors of the form and any user controls/custom controls that are used on the form as all of these constructors will be called by the designer.&amp;nbsp; If you have a Fill call in one of them, then you'll have to pull that call out and instead, override OnCreateControl and put it at the top of that method (before the MyBase.OnCreateComponent() call), but wrap your Fill in a test for design-time like:&lt;/P&gt;&lt;P&gt;If Not Me.DesignMode Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; myBo.FillWhatever()&lt;BR&gt;End If&lt;/P&gt;&lt;P&gt;This will keep it from trying to access the database at design-time.&lt;/P&gt;&lt;P&gt;As for the SharedDataTableProblem, I believe there is an outstanding issue on the SharedDataTables at design-time (we might have forgotten a test on Me.DesignMode ourselves).&amp;nbsp; If this is the case, it will be fixed soon.</description><pubDate>Thu, 06 Sep 2007 09:08:28 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item></channel></rss>