cancel
Showing results for 
Search instead for 
Did you mean: 

Converting from vb.net to c# issues

Former Member
0 Kudos

I converted the vb.net code to c# but am getting wrong records in the database table when converted to c# but in vb.net the same code is working fine. Please I need help in the image attached the code in master is not the same as rows

VB.NET CODE

If oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then

                If pVal.ItemUID = "MatrixI" And pVal.ColUID = "CDes" Then

                    oCDes = CType(oMatrixI.Columns.Item(1).Cells.Item(pVal.Row).Specific, SAPbouiCOM.EditText)

                    If oCDes.Value <> "" Then

                        oCDes = CType(oMatrixI.Columns.Item(1).Cells.Item(oMatrixI.RowCount).Specific, SAPbouiCOM.EditText)

                        If oCDes.Value <> "" Then

                            oForm.Freeze(True)

                            SBO_Application.Forms.Item("FrmG").DataSources.DBDataSources.Item("@GP_DL").Clear()

                            oMatrixI.AddRow()

                            For i As Integer = 1 To oMatrixI.RowCount

                                oMatrixI.Columns.Item(0).Cells.Item(i).Specific.Value = i

                            Next

                            oForm.Freeze(False)

                        End If

                    End If

                End If

C# CODE

if (pVal.ItemUID == "MatrixI" & pVal.ColUID == "CDes") {

  oCDes = ((SAPbouiCOM.EditText)(oMatrixI.Columns.Item(1).Cells.Item(pVal.Row).Specific)));

  if (oCDes.Value != "") {

  oCDes = ((SAPbouiCOM.EditText)(oMatrixI.Columns.Item(1).Cells.Item(oMatrixI.RowCount).Specific));

  if (oCDes.Value != "") {

  oForm.Freeze(true);

  SBO_Application.Forms.Item("FrmG").DataSources.DBDataSources.Item("@GP_DL").Clear();

  oMatrixI.AddRow();

  for (int i = 1; i <= oMatrixI.RowCount; i++) {

  SAPbouiCOM.EditText rowID = ((SAPbouiCOM.EditText)(oMatrixI.Columns.Item(0).Cells.Item(i).Specific));

                        rowID.String = i.ToString();

  }

  oForm.Freeze(false);

  }

  }

  }

DATABASE RESULT

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

If you look at the description at the top of this space, you'll find that it's specifically for the .NET SDK that comes with SAP BusinessObjects.  So, I think you've  posted in the wrong space.

-Dell

Answers (0)