I'm working on a new script that needs to access HS devices and I'm using the following sample code:
In the tenscriptingHS4 environment, Visual Studio gives me the following error for the third statement:
Option Strict On disallows implicit conversions from Object to clsDeviceEnumeration
I can see that hs.GetDeviceEnumerator returns an Object.
The recommended fix is to wrap it with a CTYPE.
This seems a bit awkward. Is there a better way to do this?
Code:
Dim dv As Scheduler.Classes.DeviceClass Dim EN As Scheduler.Classes.clsDeviceEnumeration EN = hs.GetDeviceEnumerator If EN Is Nothing Then hs.WriteLog("Error", "Error getting Enumerator") Exit Sub End If
Option Strict On disallows implicit conversions from Object to clsDeviceEnumeration
I can see that hs.GetDeviceEnumerator returns an Object.
The recommended fix is to wrap it with a CTYPE.
Code:
EN = CType(hs.GetDeviceEnumerator, Classes.clsDeviceEnumeration)
Comment