Skip to Content
0
Former Member
Apr 16, 2012 at 06:11 AM

Refer a Grid and click a selected row programmatically

148 Views

Hi,I was trying to get find selected rows in the grid below find textbox in packages screen.I am unable to refer the grid using the below code it throws me an exception.Should the grid be refereed using item number or does it have a name i have attached a screen shot of the grid . Am new to SAP B1 please help me how to refer a grid and select its content .

public SAPbouiCOM.Grid grd;

private SAPbouiCOM.Form oForm;

SAPbouiCOM.Item oItem = null;

oForm = SapApp.Forms.GetForm("60017", 1);//60017 refers to packages screen

grd =oForm.Items.Item("9").Specific;

the exception i get is Unable to cast COM object of type 'System.__ComObject' to interface type 'SAPbouiCOM.Grid'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{856B9291-F296-4A2E-8EB8-FF9189E23425}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Attachments

grd.png (70.8 kB)
grd.png (70.8 kB)