Skip to Content
avatar image
Former Member

problem with link button c#

Hello experts,

I have a problem with a grid, i created a grid with a query, then i would like to add a button link, but it give me an error, this one

The type 'SAPbouiCOM.GridColumn' can not be implicitly converted in 'SAPbouiCOM.EditTextColumn'. An explicit conversion already exists (check if a conversion is missing) and my code is

oForm = oApp.Forms.Item("formpri");
           
            oForm.Visible = true;
          
            oitem = oForm.Items.Item("grdpy");
            oGrid = ((SAPbouiCOM.Grid)(oitem.Specific));

            oForm.DataSources.DataTables.Add("grPagdt");


            oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT PayMethCod AS Código,Descript as Descripción,Active as Activo from OPYM where type='O'");
            oGrid.DataTable = oForm.DataSources.DataTables.Item("grPagdt");
            oGrid.Columns.Item("Activo").Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
            SAPbouiCOM.EditTextColumn gridEditCol;
//here is the error
            gridEditCol = oGrid.Columns.Item("Activo");
            gridEditCol.LinkedObjectType = "13";



thank you

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 13, 2017 at 03:11 PM

    Hi Esteban,

    Your code it seems confused. On this line:

    oGrid.Columns.Item("Activo").Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;

    You set your column as CheckBox, but in the line below:

    SAPbouiCOM.EditTextColumn gridEditCol;
    gridEditCol = oGrid.Columns.Item("Activo");
    

    you try to put the the checkbox column on a EditTextColumn.

    Another point in your code is that you are performing a select on OPYM table(object type 147), but you use object type 13 (invoice).

    If I understood well, this is your goal:

    f yes, use this code after your assign the datatable to the matrix

    oGrid.Columns.Item("Activo").Type = SAPbouiCOM.BoGridColumnType.gct_CheckBox;
    
    oGrid.Columns.Item("Código").Type = SAPbouiCOM.BoGridColumnType.gct_EditText;
    SAPbouiCOM.EditTextColumn oEdit = (SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("Código");
    oEdit.LinkedObjectType = "147";
    

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 13, 2017 at 02:58 PM

    You need to cast the grid column

    SAPbouiCOM.EditTextColumn gridEditCol;
                gridEditCol = (SAPbouiCOM.EditTextColumn)oGrid.Columns.Item("Activo");
    Add comment
    10|10000 characters needed characters exceeded