Return string after timeout in VB.NET

75 views Asked by At

I use the following function to send commands to an instrument and receive the query results back and it works fine.

Public Function InstrSndRcv(cmd2Send As String) As String  
     MyInstrument.WriteLine(cmd2Send) 
    ' if myTimeout(desierdtime) then
    'Return "my string"
    'else 
    Dim qryRetrn As String = MyInstrument.ReadLine()  
    Return qryRetrn
    'End if
End Function

I have commented out the conditional functionality I need in terms of a subroutine myTimeout(desiredtime). How to implement it in VB.NET?

The idea is to return "my string" in case the instrument does not respond to a query command. May be there is a better way to do this...

0

There are 0 answers