StrataFrame Forum

SharedDataTableKey Error - Key not present in the Dictionary

http://forum.strataframe.net/Topic8100.aspx

By Tim Dol - 4/12/2007

I have a SF User Control that displays data on a grid. The Edit button displays a maintenance form dialog box so I can maintain the data.  I could not get a child dialog and BO Translations working on the user control, so after two days of failed attempts I decided to try using a SharedDataTableKey, which I found on a number of forum postings. 

I entered a value for the SharedDataTableKey property on my maintenance form business object.  I then entered the same value on the user control business object.  This seemed to give me the results I was expecting, except now anytime I try to access the user control form in Visual Studio I receive the attached error.  If I go into the designer and remove the line that sets the SharedDataTableKey property, I am able to view the user control once again.

So I'm kind of stuck because I can't seem to get either option working correctly.

Thanks,
Tim

 

By Tim Dol - 4/12/2007

Sorry, forgot to attach the error...BigGrin

Also, I am using a BusinessBindingSource on the user control.

Tim

By Trent L. Taylor - 4/13/2007

In your current environment and the way you have it setup with your user control, the BO may be trying to instantiate and reference the SharedDataTableKey.  When you create controls you have to check on the design mode (Me.DesignMode).  If this is False then it is safe to set this key, otherwise you may receive the error you are getting because the actual sessions for the data source keys is not established at design time.
By Ivan George Borges - 5/3/2007

Can I jump in here? (well, too late to ask)

I've got two forms sharing some BOs. I've set the SharedDataTableKeys for them. In one of them, I will be using an UltraGrid, so I dropped a BusinessBindingSource in it, and as soon as I set its BusinessObject property, I get the "The given key was not present in the dictionary." message. Any advices?

By StrataFrame Team - 5/3/2007

It's looking like a design-time issue.  If the business object is at design-time, it shouldn't be trying to pull the shared DataTable.  Let me check it out; it might take some debugging.  Visual Studio isn't nice enough to give us a stack trace of where the problem is occuring... just the error itself.
By Ivan George Borges - 5/3/2007

Yes, Ben, this is at design time. And, of course, no stack trace... bad Visual Studio Sad