on 09-10-2018 5:58 AM
I am getting Error "Unable to cast COM object of type 'System.__ComObject' to interface type 'SAPbouiCOM.Columns'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C830390A-4D84-4DA6-8D9A-91322F9A37EC}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))." while binging Grid column . Here is my code
Public Sub BindGrid()
Dim objgrid As SAPbouiCOM.Grid
Try
Dim oColumns As SAPbouiCOM.Columns
Dim oColumn As SAPbouiCOM.Column
oForm = objMain.objApplication.Forms.ActiveForm
objgrid = oForm.Items.Item("11").Specific
oColumns = objgrid.Columns
oColumn = oColumns.Item("ItemCode")
oColumn.DataBind.SetBound(True, "WTQ1", "ItemCode")
oColumn = oColumns.Item("Item Name")
oColumn.DataBind.SetBound(True, "WTQ1", "Dscription")
oColumn = oColumns.Item("Qty")
oColumn.DataBind.SetBound(True, "WTQ1", "Quantity")
oColumn = oColumns.Item("From Whs")
oColumn.DataBind.SetBound(True, "WTQ1", "FromWhsCod")
oColumn = oColumns.Item("ToWH")
oColumn.DataBind.SetBound(True, "WTQ1", "WhsCode")
Catch ex As Exception
MessageBox.Show(ex.Message)
objMain.LogError(ex)
End Try
End Sub
Hi Megha,
You work with grid as with matrix. The Grid interface doesn't have property of type "Columns" it has "GridColumns" instead (same with "Column"). If you want to bind the data source to a grid you can use the DataTable property. Example from the SDK help:
Set oDataTable = oForm.DataSources.DataTables.Item(m_DataTableUid)
queryStr = "Select 0, CardName, CardType, GroupNum from OCRD"
oDataTable.ExecuteQuery queryStr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
11 | |
10 | |
6 | |
5 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.