question

kavehrahimi-5744 avatar image
0 Votes"
kavehrahimi-5744 asked XingyuZhao-MSFT commented

Expression expected

I write these four lines in my code and receive 'BC30201' expression expected error.How can I resolve this error please help.
the lines are:
Private Declare Function ch341opendevice Lib "ch341dll.dll" (ByVal iindex As Integer) As Integer

 Sub main()
     Console.WriteLine(ch341opendevice(Byval iindex as integer) As Integer)
 End Sub
dotnet-visual-basic
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @kavehrahimi-5744 ,
May I know whether your issue has been solved or not? If not, please share it in here.

0 Votes 0 ·
Viorel-1 avatar image
1 Vote"
Viorel-1 answered

Try something like this:

 Console.WriteLine( ch341opendevice(0) )

Pass the correct parameter if 0 is not suitable.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

XingyuZhao-MSFT avatar image
0 Votes"
XingyuZhao-MSFT answered Viorel-1 commented

Hi @kavehrahimi-5744 ,
A parameter of method should be a specific value or variable, not a declaration of another method.
You need to pass the result of ‘ch341opendevice’ into ‘Console.WriteLine’ method.

     Sub Main()
         Dim result As Integer = ch341opendevice(0)
         Console.WriteLine(result)
         Console.ReadLine()
     End Sub

Best Regards,
Xingyu Zhao


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.