unhandled exception runtime error

kaveh rahimi 61 Reputation points
2021-04-26T14:05:34.517+00:00

Hi I run my code and receive unhandled exception runtime error.
This is my code:
Imports System.Runtime.InteropServices
Module Program
Private Declare Function inp Lib "ch341dll.dll" ()
Private Declare Function outp Lib "ch341dll.dll" ()
Function mPCH341_NOTIFY_ROUTINE(iEVENTStatus As String) As String
Return iEVENTStatus
End Function

Const ch341_DEVICE_ARRIVAL As Integer = 3
Const ch341_DEVICE_REMOVE_PEND As Object = 1
Const ch341_DEVICE_REMOVE = 0
Function ch341opendevice(iIndex As Integer) As Integer
    Return ch341opendevice
End Function
Function ch341writei2c(iIndex As ULong, iDevice As UInteger, iAddr As UInteger, iByte As UInteger) As Integer
    Return ch341writei2c
End Function



Sub main()
    Dim notify As Integer
    Dim iIndex As ULong = 0
    Dim iDevice As UInteger = 0
    Dim iAddr As UInteger = 0
    Dim iByte As UInteger = 290
    Dim x As Object
    'x = deviceremovepend(notify)
    Call command1_devicearrival()
End Sub




Sub command1_devicearrival()
    Dim command1 As Object = ch341_DEVICE_ARRIVAL
    command1.devicearrival = ch341_DEVICE_ARRIVAL
    Do Until TypeOf command1 Is Integer = 3

    Loop
    Console.WriteLine("Port Connected")
End Sub

End Module
Please help me.
Thanks

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,125 questions
0 comments No comments
{count} votes