Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
key not found - Parameter name: key
posted

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?

 ==================================================================

Dim OptiSaveViewGroup As New clsGroups()

'.....................................

Dim osvgGroupDataSet As DataSet = OptiSaveViewGroup.GetOptiSaveViewData2(CInt(txtRunNumber.Text))

'------------------------------------

Dim Grid1 As UltraWinGrid.UltraGrid

Grid1 = New UltraWinGrid.UltraGrid

With Grid1

.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.

Parents
  • 469350
    Verified Answer
    Offline posted

    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.  

Reply Children