Error adding data to a second created column in a grid - 8.03.40

That did the trick, thank you very much! I have some very happy Engineers and Inventory Management folk. Not the first time you've made me look good! I ended up adding a hidden summary field anyway so I could make a nice image column to indicate whether the part was active vs. obsolete vs. unapproved.

Thanks again,

Kirstin

--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> It would be my guess, that by altering a value in the grid causes the row to intialize again, again, again, etc
>
> You may have to resort to adding the columns to the dataview the control is bound to, and then looping through each row of the dataview and plug in the data from a part lookup once the datavie is initialized and has rows.
>
> See some of my earlier posts about adding columns to TimePhase for ideas...
>
> bw
>
> --- In vantage@yahoogroups.com, "kirstin.brandt" <kirstin.brandt@> wrote:
> >
> > I'm trying to add two columns to the WhereUsed form under Part Tracker, one for Part.Inactive and one for PartRev.Approved. The code for adding the data works fine if I only try to add one column or the other and both columns are created if I don't try to add data to the second column, but as soon as I do I get a runtime error.
> >
> > I can always use the data to create a "Status" string, but I'd really like to get this working if possible. Does anybody have any ideas?
> >
> > Simplified Code substituting strings for the adapter calls:
> >
> > Private Sub WhereUsed_Load(ByVal sender As object, ByVal args As EventArgs) Handles WhereUsed.Load
> > gWhereUsed = CType(csm.GetNativeControlReference("381ee2d9-7c1e-4cfb-99b2-d3edbb6e6f83"), EpiUltraGrid)
> > gWhereUsed.DisplayLayout.Bands(0).Columns.Add("Inactive", "Inactive")
> > gWhereUsed.DisplayLayout.Bands(0).Columns.Add("Approved", "Approved")
> > End Sub
> >
> > Private Sub gWhereUsed_InitializeRow(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles gWhereUsed.InitializeRow
> > Args.Row.Cells("Inactive").Value = "Inactive Data"
> > Args.Row.Cells("Approved").Value = "Approved Data"
> > End Sub
> >
> >
> >
> > Error Detail
> > ============
> > Exception has been thrown by the target of an invocation.
> >
> >
> > Stack Trace
> > ===========
> > at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
> > at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
> > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
> > at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
> > at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
> > at Epicor.Mfg.UI.Customization.CustomScriptManager.OnCustomCodeFormLoad(Object sender, EventArgs e)
> >
> > Inner Exception
> > ===============
> > Key not found
> > Parameter name: key
> >
> > Inner 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 Script.gWhereUsed_InitializeRow(Object Sender, InitializeRowEventArgs Args)
> > at Infragistics.Win.UltraWinGrid.UltraGrid.OnInitializeRow(InitializeRowEventArgs e)
> > at Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(GridEventIds id, EventArgs e)
> > at Infragistics.Win.UltraWinGrid.UltraGrid.FireInitializeRow(InitializeRowEventArgs e)
> > at Infragistics.Win.UltraWinGrid.UltraGridRow.FireInitializeRow()
> > at Infragistics.Win.UltraWinGrid.UltraGridRow.OnColumnsChanged()
> > at Infragistics.Win.UltraWinGrid.UltraGridBand.OnColumnsChanged()
> > at Infragistics.Win.UltraWinGrid.UltraGridBand.OnSubObjectPropChanged(PropChangeInfo propChange)
> > at Infragistics.Shared.SubObjectBase.NotifyPropChange(PropChangeInfo trigger)
> > at Infragistics.Shared.SubObjectBase.NotifyPropChange(Enum propId)
> > at Infragistics.Win.UltraWinGrid.ColumnsCollection.Add(String key, String caption)
> > at Script.WhereUsed_Load(Object sender, EventArgs args)
> >
>
I'm trying to add two columns to the WhereUsed form under Part Tracker, one for Part.Inactive and one for PartRev.Approved. The code for adding the data works fine if I only try to add one column or the other and both columns are created if I don't try to add data to the second column, but as soon as I do I get a runtime error.

I can always use the data to create a "Status" string, but I'd really like to get this working if possible. Does anybody have any ideas?

Simplified Code substituting strings for the adapter calls:

Private Sub WhereUsed_Load(ByVal sender As object, ByVal args As EventArgs) Handles WhereUsed.Load
gWhereUsed = CType(csm.GetNativeControlReference("381ee2d9-7c1e-4cfb-99b2-d3edbb6e6f83"), EpiUltraGrid)
gWhereUsed.DisplayLayout.Bands(0).Columns.Add("Inactive", "Inactive")
gWhereUsed.DisplayLayout.Bands(0).Columns.Add("Approved", "Approved")
End Sub

Private Sub gWhereUsed_InitializeRow(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles gWhereUsed.InitializeRow
Args.Row.Cells("Inactive").Value = "Inactive Data"
Args.Row.Cells("Approved").Value = "Approved Data"
End Sub



Error Detail
============
Exception has been thrown by the target of an invocation.


Stack Trace
===========
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Epicor.Mfg.UI.Customization.CustomScriptManager.OnCustomCodeFormLoad(Object sender, EventArgs e)

Inner Exception
===============
Key not found
Parameter name: key

Inner 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 Script.gWhereUsed_InitializeRow(Object Sender, InitializeRowEventArgs Args)
at Infragistics.Win.UltraWinGrid.UltraGrid.OnInitializeRow(InitializeRowEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(GridEventIds id, EventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGrid.FireInitializeRow(InitializeRowEventArgs e)
at Infragistics.Win.UltraWinGrid.UltraGridRow.FireInitializeRow()
at Infragistics.Win.UltraWinGrid.UltraGridRow.OnColumnsChanged()
at Infragistics.Win.UltraWinGrid.UltraGridBand.OnColumnsChanged()
at Infragistics.Win.UltraWinGrid.UltraGridBand.OnSubObjectPropChanged(PropChangeInfo propChange)
at Infragistics.Shared.SubObjectBase.NotifyPropChange(PropChangeInfo trigger)
at Infragistics.Shared.SubObjectBase.NotifyPropChange(Enum propId)
at Infragistics.Win.UltraWinGrid.ColumnsCollection.Add(String key, String caption)
at Script.WhereUsed_Load(Object sender, EventArgs args)
It would be my guess, that by altering a value in the grid causes the row to intialize again, again, again, etc

You may have to resort to adding the columns to the dataview the control is bound to, and then looping through each row of the dataview and plug in the data from a part lookup once the datavie is initialized and has rows.

See some of my earlier posts about adding columns to TimePhase for ideas...

bw

--- In vantage@yahoogroups.com, "kirstin.brandt" <kirstin.brandt@...> wrote:
>
> I'm trying to add two columns to the WhereUsed form under Part Tracker, one for Part.Inactive and one for PartRev.Approved. The code for adding the data works fine if I only try to add one column or the other and both columns are created if I don't try to add data to the second column, but as soon as I do I get a runtime error.
>
> I can always use the data to create a "Status" string, but I'd really like to get this working if possible. Does anybody have any ideas?
>
> Simplified Code substituting strings for the adapter calls:
>
> Private Sub WhereUsed_Load(ByVal sender As object, ByVal args As EventArgs) Handles WhereUsed.Load
> gWhereUsed = CType(csm.GetNativeControlReference("381ee2d9-7c1e-4cfb-99b2-d3edbb6e6f83"), EpiUltraGrid)
> gWhereUsed.DisplayLayout.Bands(0).Columns.Add("Inactive", "Inactive")
> gWhereUsed.DisplayLayout.Bands(0).Columns.Add("Approved", "Approved")
> End Sub
>
> Private Sub gWhereUsed_InitializeRow(ByVal Sender As Object, ByVal Args As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles gWhereUsed.InitializeRow
> Args.Row.Cells("Inactive").Value = "Inactive Data"
> Args.Row.Cells("Approved").Value = "Approved Data"
> End Sub
>
>
>
> Error Detail
> ============
> Exception has been thrown by the target of an invocation.
>
>
> Stack Trace
> ===========
> at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
> at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
> at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
> at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
> at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
> at Epicor.Mfg.UI.Customization.CustomScriptManager.OnCustomCodeFormLoad(Object sender, EventArgs e)
>
> Inner Exception
> ===============
> Key not found
> Parameter name: key
>
> Inner 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 Script.gWhereUsed_InitializeRow(Object Sender, InitializeRowEventArgs Args)
> at Infragistics.Win.UltraWinGrid.UltraGrid.OnInitializeRow(InitializeRowEventArgs e)
> at Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(GridEventIds id, EventArgs e)
> at Infragistics.Win.UltraWinGrid.UltraGrid.FireInitializeRow(InitializeRowEventArgs e)
> at Infragistics.Win.UltraWinGrid.UltraGridRow.FireInitializeRow()
> at Infragistics.Win.UltraWinGrid.UltraGridRow.OnColumnsChanged()
> at Infragistics.Win.UltraWinGrid.UltraGridBand.OnColumnsChanged()
> at Infragistics.Win.UltraWinGrid.UltraGridBand.OnSubObjectPropChanged(PropChangeInfo propChange)
> at Infragistics.Shared.SubObjectBase.NotifyPropChange(PropChangeInfo trigger)
> at Infragistics.Shared.SubObjectBase.NotifyPropChange(Enum propId)
> at Infragistics.Win.UltraWinGrid.ColumnsCollection.Add(String key, String caption)
> at Script.WhereUsed_Load(Object sender, EventArgs args)
>