When I run the following code (VB.Net) I get the error message: key not found Parameter name: key when I try to attach the [Grid] to a [Tab]
Is this a "key" property with the [Grid] or with the [Tab] that it resides on?
I'm dynamically adding the [Tab] and the [Grid] at runtime.
If I insert a [Grid] on a [Tab] at design and run similar code to load my data, I do not get this error message.
What have I missed?
==================================================================
'.....................................
'------------------------------------
Grid1 = New UltraWinGrid.UltraGrid
.DataSource = osvgGroupDataSet
.DisplayLayout.Appearance.BackColor = Color.White
.DisplayLayout.Appearance.BorderColor = Color.DarkGray
.DisplayLayout.Appearance.Key = "Tab2"
.DisplayLayout.Bands(0).HeaderVisible = True
.DisplayLayout.Bands(0).Header.Caption = "OptiSave Report"
.DisplayLayout.Bands(0).AutoPreviewEnabled = True
.DisplayLayout.AutoFitStyle = UltraWinGrid.AutoFitStyle.ResizeAllColumns
.DisplayLayout.ScrollBounds = UltraWinGrid.ScrollBounds.ScrollToFill
.DisplayLayout.ScrollStyle = UltraWinGrid.ScrollStyle.Immediate
.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.True
.Dock = DockStyle.Fill
End With
UltraTabControl1.Tabs(ActiveTabName).TabPage.Controls.Add(Grid1)
Grid1.Refresh()
Thanks ahead of time.
That error usually means you are trying to refer to an object in a collection by a key that does not exist in the collection. My guess is that your UltraTabControl does not have a tab whose key is ActiveTabName.
Hi Mike ,
i have similar issue ,pls help me in this regard.
Client Handler ID:5968c4ff-38ce-4d7c-9c9b-69ea98eacb6b---------------------------------------------------------------------------------------------------Exception Message:Key not found: 'TYPE_KEY'Parameter name: key---------------------------------------------------------------------------------------------------Stack Trace: at Infragistics.Shared.KeyedSubObjectsCollectionBase.GetItem(String key) at Infragistics.Win.UltraWinGrid.ColumnsCollection.get_Item(String key) at Infragistics.Win.UltraWinGrid.CellsCollection.GetItem(String key) at Infragistics.Win.UltraWinGrid.CellsCollection.get_Item(String key) at SearchEditEntityView.SelectedRow() at SearchEditEntityView.SearchGrid_DoubleClickRow(Object sender, DoubleClickRowEventArgs e) at Infragistics.Win.UltraWinGrid.UltraGrid.OnDoubleClickRow(DoubleClickRowEventArgs e) at Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(GridEventIds id, EventArgs e) at Infragistics.Win.UltraWinGrid.GridCellEmbeddableEditorOwnerInfoBase.OnEditorDoubleClick(EmbeddableUIElementBase embeddableElem, EmbeddableClickEventArgs e) at Infragistics.Win.EmbeddableUIElementBase.RaiseDoubleClickEvent(UIElement sender, Boolean isButton) at Infragistics.Win.EmbeddableUIElementBase.OnDoubleClick(Boolean adjustableArea) at Infragistics.Win.UIElement.OnDoubleClick(Boolean adjustableArea) at Infragistics.Win.ControlUIElementBase.ProcessDoubleClick(Object sender, EventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraControlBase.OnDoubleClick(EventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.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)
Hi Lava,
This exception indicates that you are trying to reference a Cell in the grid using a Key of a column that does not exist. You should probably check out that code and see why you are doing that. Maybe it's an unbound column and you are trying to access the cell before that column was added? If so, then a simple solution would be to use the Exists method to make sure the cell is there before you try to access it, just as I did in the sample code above.
There is an another issue , where when I am tabbing it is giving me a "Object reference not set to an instance of an object exception" ..
below is the exception details , when I debugged I got to know that "obj.FocusControl " is null ,pls guide me in this on setting the Focus Control property with some thing from the code.
Exception Message:
Object reference not set to an instance of an object.
---------------------------------------------------------------------------------------------------
Stack Trace:
at views..SearchGrid_KeyDown(Object sender, KeyEventArgs e)
at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
at Infragistics.Win.UltraControlBase.OnKeyDown(KeyEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGridBase.EditorContainerControlOnKeyDown(KeyEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGridBase.OnKeyDownForwarded(KeyEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGridLayout.OnEditorKeyDown(Object sender, KeyEventArgs e)
at Infragistics.Win.EmbeddableEditorBase.RaiseKeyDownEvent(KeyEventArgs e)
at Infragistics.Win.EmbeddableTextBox.OnKeyDown(KeyEventArgs e)
at Infragistics.Win.EmbeddableTextBoxWithUIPermissions.ProcessKeyMessage(Message& msg)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at Infragistics.Win.EmbeddableTextBoxWithUIPermissions.WndProcInternal(Message& m)
at Infragistics.Win.EmbeddableTextBoxWithUIPermissions.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)
I'm not sure how I can help you with this. According to the call stack, the exception is occurring in the KeyDown event handler for your grid. So it's your code that's raising the exception because you are trying to reference a property of an object that is null. You need to find out why that object is null or add a null check so that code does not get called when there's no object to call the method on.
I'm getting something similar, can you decipher?
System.ArgumentException: Key not found Parameter name: key at Infragistics.Shared.KeyedSubObjectsCollectionBase.GetItem(String key) at Infragistics.Win.UltraWinGrid.ColumnsCollection.get_Item(String key) at Infragistics.Win.UltraWinGrid.UltraGridBand.get_ScrollTipCol() at Infragistics.Win.UltraWinGrid.UltraGridRow.GetScrollTip(Int32& lineCount) at Infragistics.Win.UltraWinGrid.RowScrollRegion.ScrollRows(ScrollEventType scrollType, ScrollRowsContext& src) at Infragistics.Win.UltraWinGrid.RowScrollRegion.OnScroll(ScrollBarInfo scrollBar, ScrollEventType scrollType, Boolean exitEditMode, Boolean invalidateRegion) at Infragistics.Win.UltraWinGrid.ScrollRegionBase.OnScroll(Object sender, ScrollEventArgs e) at Infragistics.Win.UltraWinScrollBar.ScrollBarInfo.OnScroll(ScrollEventArgs e) at Infragistics.Win.UltraWinScrollBar.ScrollBarInfo.StartThumbDrag(Int32 offsetX, Int32 offsetY) at Infragistics.Win.UltraWinScrollBar.ScrollThumbUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e) at System.Windows.Forms.MouseEventHandler.Invoke(Object sender, MouseEventArgs e) at System.Windows.Forms.Control.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.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)
According to this, the grid is trying to get the ScrollTipField column and the name you specified for the ScrollTipField does not exist in the band.