Can anyone shed some light on this error?
System.ArgumentException: {"Key not foundParameter name: key"}
Message:Key not foundParameter name: key
StackTrace: at Infragistics.Shared.KeyedSubObjectsCollectionBase.GetItem(String key) at Infragistics.Win.UltraWinGrid.ColumnsCollection.get_Item(String key) at NBSControls.BondSourcesUsesBase.ugSources_InitializeLayout(Object sender, InitializeLayoutEventArgs e) in C:\Documents and Settings\mhsueh\My Documents\Visual Studio 2005\Projects\DFAST3\Controls\District\BondSourcesUsesBase.vb:line 29
Yes,
Some code in your InitializeLayout event handler is trying to access an object in a collection by a key that does not exist. Probably a column.
That was my first thought, but I have been through the tools multiple times, and compared values in the toolbar customize with values in the <formname>.designer.cs to make sure everything was in sync, and the error still occurs.
What does the "toolbar customize" have to do with it? The error message here is referring to the Columns collection in a WinGrid control.
Have you tried stepping through the InitializeLayout code to see what line of code the error is occurring on?
This error message is very clear and very common. There's no mystery about it. Your code is definitely trying to access a column in the grid using a Key that does not exist in the collection.
If the Debugger doesn't break on the exact line of code that's causing the issue, then you may need to set Visual Studio to break on all run-time exceptions - the error is probably being caught by the grid and masking the true source of the error.
I am getting this error on the toolbar, not the wingrid. I am looking for a solution, and following all threads. This began yesterday when I went through and changed some captions on toolbar buttons, compiled the app, ran it, and the new caption values were not present at runtime. I then went through and updated the keys for each toolbar button to match the caption. After that change, things go boom! I keep getting this "key not found" error. I have copied and pasted, etc. to make sure they all have the same verbage and the problem continues. I admit, I am new to your controls. I started this job 2 months ago and I am working to make requested mods to an existing application. Feel free to email me off-line.
FYI, I also replied to the "Key not found for UltraToolbar" posting. That may help you understand what I am up against.
The error message you posted here clearly indicates that the exception is occurring in the InitializeLayout event of the grid. So some code in that event is referring to an object in a collection by key and that key does not exist in the collection. The message specifically refers to the columns collection.
So if you are getting an exception on the toolbar, also, then the call stack you posted here must be the wrong one.
Did you try breaking on all exceptions like I suggested?
Hi Mike,
I am also getting the same problem in Ultratoolbar Manager when I am trying to Merge two toolbars. I replicated the problem in a sample app. Can you please let me know how can I send the app to you or concerned person? Here is the Stack Trace
System.ArgumentException: Key not foundParameter name: key at Infragistics.Shared.KeyedSubObjectsCollectionBase.GetItem(String key) at Infragistics.Win.UltraWinToolbars.ToolsCollectionBase.get_Item(String key) at Infragistics.Win.UltraWinToolbars.ToolBase.InternalSetUnderlyingTool(ToolBase underlyingMdiChildTool) at Infragistics.Win.UltraWinToolbars.ToolsCollectionBase.MergeMdiChildTools(ToolsCollection childToolsCollection) at Infragistics.Win.UltraWinToolbars.RibbonGroup.MergeMdiChildGroup(RibbonGroup childGroup) at Infragistics.Win.UltraWinToolbars.RibbonTab.MergeMdiChildTab(RibbonTab childTab) at Infragistics.Win.UltraWinToolbars.Ribbon.MergeMdiChildTabs(Ribbon childRibbon) at Infragistics.Win.UltraWinToolbars.Ribbon.MergeMdiChild(Ribbon childRibbon) at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.MergeMdiChild(UltraToolbarsManager childToolbarsManager) at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.InternalSetActiveMdiChildManager(UltraToolbarsManager newActiveMdiChildManager, Boolean calledFromMdiChildActivate, Boolean remergeIfUnchanged) at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnFormMdiChildActivated(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnMdiChildActivate(EventArgs e) at System.Windows.Forms.Form.ActivateMdiChildInternal(Form form) at System.Windows.Forms.Form.WmMdiActivate(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)