Type mismatch when returning an object type to Integer

-2

Code:

Dim lngMaxConvicts As Integer

'--- Get Conviction Information ------------------------------------------------------------
Dim oRes As Object = CreateObject6("CSSResources.CResources")
Const FIELD_LIST_CONVICTIONS = 53

' Error occurs in this line with 'lngMaxConvicts' highlighted
lngMaxConvicts = GetDefaultMember6(oRes.GetList(FIELD_LIST_CONVICTIONS, strConvictions)) - 1 
'GetDefaultMember6() returns an Object type
oRes = Nothing

Error:

System.Runtime.InteropServices.COMException: 'Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))'

Edit:

Custom functions:

Public Function CreateObject6(progId As String, Optional serverName As String = "") As Object
Public Function GetDefaultMember6(obj As Object, ParamArray args() As Object) As Object
vb.net
asked on Stack Overflow Aug 26, 2019 by Snehil Maknojia • edited Aug 26, 2019 by Snehil Maknojia

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0