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.
Hi Mike,
I am facing the same problem refer below trace.
Error is
Key Not Found
Parameter Name:key
at Infragistics.Shared.KeyedSubObjectsCollectionBase.GetItem(String key) at Infragistics.Win.UltraWinGrid.ColumnsCollection.get_Item(String key) at Project_Name.frmMain.ugVisitIDList_InitializeLayout(Object sender, InitializeLayoutEventArgs e) at Infragistics.Win.UltraWinGrid.UltraGrid.OnInitializeLayout(InitializeLayoutEventArgs e) at Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(GridEventIds id, EventArgs e) at Infragistics.Win.UltraWinGrid.UltraGridLayout.ApplyLoadedBands() at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated(BindingManagerBase bindingManager) at Infragistics.Win.UltraWinGrid.UltraGridLayout.ListManagerUpdated() at Infragistics.Win.UltraWinGrid.UltraGridBase.Set_ListManager(Object newDataSource, String newDataMember) at Infragistics.Win.UltraWinGrid.UltraGridBase.set_DataSource(Object value) at Project_Name.frmMain.btnGenerateList_Click(Object sender, EventArgs e)
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.
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)
Hi Lava,
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.
Hi Mike ,
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)