试图将读卡器从 VB6 适配到 vb.net。转换后出现此错误:
'AddressOf' expression cannot be converted to 'Integer' because 'Integer' is not a delegate type
这是我正在使用的代码:
Public Sub SetupCallBacks()
'UPGRADE_WARNING: Add a delegate for AddressOf OnEventDeviceStateChanged Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
Call MTUSCRADeviceStateChangedNotify(AddressOf OnEventDeviceStateChanged)
'UPGRADE_WARNING: Add a delegate for AddressOf OnEventCardDataStateChanged Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="E9E157F7-EF0C-4016-87B7-7D7FBBC6EE08"'
Call MTUSCRACardDataStateChangedNotify(AddressOf OnEventCardDataStateChanged)
End Sub
Public Sub OnEventDeviceStateChanged(ByVal parm As Integer)
If (gbEvents) Then
If (glDeviceState <> parm) Then
glDeviceState = parm
End If
Select Case glDeviceState
Case MTSCRA_STATE_DISCONNECTED
SetStatus(("OnEventDeviceStateChanged:Disconnected"))
Case MTSCRA_STATE_CONNECTED
SetStatus(("OnEventDeviceStateChanged:Connected"))
Case MTSCRA_STATE_ERROR
SetStatus(("OnEventDeviceStateChanged:Error"))
End Select
End If
End Sub
据我所知,我需要与代表做一些事情,但我不知道该怎么做。