Hi Experts,
I am developing an add-on for SBO 9.0 and my IDE tool is MS Visual Studio 2005. There comes a scenario where I need to set a CFL on one of my screens. Let's say I have two columns -- Item Code and Item Name. Since I have some previous solutions with CFL codes, I have decided to reuse them.
Below is the code I used on some project for SBO 8.81:
void ItemEvent(SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = true;
SAPbouiCOM.ChoosefromListEvent cflEvent = null;
SAPbouiCOM.ChoosefromList cfl = null;
SAPbouiCOM.DataTable dtRecords = null;
if (FormUID == <myform> && pVal.EventType == <cfl_event> &&
pVal.BeforeAction...)
{
cflEvent = pVal as SAPbouiCOM.ChoosefromListEvent;
if (dtRecords.SelectedObjects == null)
return;
else
dtRecords = cflEvent;
SAPbouiCOM.Matrix mtx = <myform>.<items>.<item>...
SAPbouiCOM.DBDataSource dbds = <myform>.<datasources>.<dbdatasources>...
mtx.FlushToDataSource();
for (int i = 0; i < dtRecords.Rows.Count; i++)
{
string itemName = dtRecords.GetValue("ItemName", 0).ToString();
dbds.InsertRecord(i);
dbds.SetValue("U_itemName", i, itemName);
}
mtx.LoadFromDataSource();
dbds.Clear();
}
}
SBO crashes and close after I select items from the CFL form. Please help! got this code working on previous SBO versions.