question

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

Control application

Hi ,I want to control the input and output of "I2C Tools" from a visual basic program. I use the following code and receive the errors:
BC30205 and BC30002
Module Module1

 Sub Main()
     Dim myProcess As Process = New Process()
     Dim s As String myProcess.StartInfo.FileName = "cmd.exe"
    
 myProcess.StartInfo.UseShellExecute = False
     myProcess.StartInfo.CreateNoWindow = True
     myProcess.StartInfo.RedirectStandardInput = True
     myProcess.StartInfo.RedirectStandardOutput = True
     myProcess.StartInfo.RedirectStandardError = True
     myProcess.Start()

     Dim sIn As StreamWriter = myProcess.StandardInput
     Dim sOut As StreamReader = myProcess.StandardOutput
     Dim sErr As StreamReader = myProcess.StandardError

     sIn.AutoFlush = True
     sIn.Write("dir c:\windows\system32\*.com" & System.Environment.NewLine)
     sIn.Write("exit" & System.Environment.NewLine)
     s = sOut.ReadToEnd()

     If Not myProcess.HasExited Then
         myProcess.Kill()
     End If


 End Sub

End Module
How can I resolve this errors?
Please help
Thanks

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 ,
Do you still meet this issue?
If so, which line of the code show BC30002 error?
We are waiting for your update.

0 Votes 0 ·

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered Castorix31 edited

You have put 2 instructions on the same line :

 Dim s As String myProcess.StartInfo.FileName = "cmd.exe"

=>

 Dim s As String 
 myProcess.StartInfo.FileName = "cmd.exe"



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.