How do you wait for an Rexec command to end?

I am trying to execute UNIX command using Rexec control. This command takes at least 2 min to run. The problem is that Visual Basic does not wait until execution completed and the application keeps running. How can I check from VB when the execution of the command is completed?

Date Entered: 09/08/1997    Last Updated: 07/25/2000

The Unix host will disconnect when the command has finished execution. The control returns to the control immediately so that you can issue input commands to Rexec via StdIn property.

If you need to wait for the Disconnected Event you can do it like below:

     (declarations)
     Dim gDisconnected% 'declare global flag

     bDisconnected = FALSE 'initialize to FALSE
     Rexec1.Command = "longrunningcommand"
     Do
        DoEvents  'loop while in execution Loop
     While not bDisconnected% 

     Sub Rexec1_Disconnected (StatusCode As Integer, _
          Description As String)
     bDisconnected% = TRUE 'set flag End Sub


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.