SharedDataTableKey Error - Key not present in the Dictionary


Author
Message
Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
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

 


Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
Sorry, forgot to attach the error...BigGrin

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

Tim

Attachments
SFError2.png (99 views, 43.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
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?

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Yes, Ben, this is at design time. And, of course, no stack trace... bad Visual Studio Sad
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search