Skip to Content
0

problem with link button c#

Nov 13, 2017 at 01:29 PM

92

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
DIEGO LOTHER Nov 13, 2017 at 03:11 PM
0

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


img.png (40.3 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

thank you, really works your answer, thank you so much.

greetings,

0
Danilo Kasparian Nov 13, 2017 at 02:58 PM
0

You need to cast the grid column

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