Skip to Content
0
Former Member
Jul 28, 2016 at 01:24 AM

Converting from vb.net to c# issues

45 Views

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

Attachments

db.PNG (8.3 kB)