Skip to Content
0
Former Member
Apr 19, 2011 at 09:26 PM

Data on a specific cell

40 Views

hi all,

I tried to fill a row with data that is selected from a cfl how far you've come to is this ...

if (pVal.ItemUID == "colItemCod" || sCflId.ToString() == "CFL_5")
                        {
                            
                            try
                            {
                                SAPbouiCOM.Matrix oMatrix;
                                int i = pVal.Row;

                                oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific;

                                forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_ItemCode", 0, System.Convert.ToString(oDataTable.GetValue("ItemCode", 0)));
                                forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Dscript", 0, System.Convert.ToString(oDataTable.GetValue("ItemName", 0)));
                                if(i == oMatrix.RowCount)
                                {
                                     oMatrix.AddRow(1, 0);
                                }
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.Message);
                            }
                        }

what happens is that when I select a specific cell value does not change...

I have another way to do it but I get an error of type "Item can not get focus"

if (pVal.ItemUID == "colItemCod" || sCflId.ToString() == "CFL_5")
                        {

                            try
                            {
                                SAPbouiCOM.Matrix oMatrix;
                                SAPbouiCOM.EditText oEdit;
                                int i = pVal.Row;

                                oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific;

                                
                                oEdit = (SAPbouiCOM.EditText)oMatrix.GetCellSpecific("colItemCod", i);

                                oEdit.String = System.Convert.ToString(oDataTable.GetValue("ItemCode", 0));
                             
                                if(i == oMatrix.RowCount)
                                {
                                    oMatrix.AddRow(1, 0);
                                }
                            }
                            catch (Exception e)
                            {
                                MessageBox.Show(e.Message);
                            }
                        }
                    }

regards.