Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 将输出控制台(cmd.exe)连接到vb6文本框或panal_Vb.net_Vb6 - Fatal编程技术网

Vb.net 将输出控制台(cmd.exe)连接到vb6文本框或panal

Vb.net 将输出控制台(cmd.exe)连接到vb6文本框或panal,vb.net,vb6,Vb.net,Vb6,如何将输出控制台(cmd.exe)连接到vb6文本框或panal: 我尝试按照以下步骤进行操作: 单击按钮(将运行批处理文件) 因此,我想在vb6文本框中显示批处理文件的输出,或者在vb6面板上显示控制台输出 有人能帮我吗 我使用了以下简单代码: Private Sub Command11_Click(Index As Integer) Dim sPathUser As String sPathUser = Environ$("EENV") Shell sPathUser & "\X

如何将输出控制台(cmd.exe)连接到vb6文本框或panal: 我尝试按照以下步骤进行操作:

  • 单击按钮(将运行批处理文件) 因此,我想在vb6文本框中显示批处理文件的输出,或者在vb6面板上显示控制台输出
有人能帮我吗

我使用了以下简单代码:

Private Sub Command11_Click(Index As Integer)
Dim sPathUser As String
sPathUser = Environ$("EENV")
Shell sPathUser & "\Xyz.bat"
End Sub

所以,我只想在拨号框、文本编辑器或简单编辑器上显示“Xyz.bat”控制台输出?

我给你我的工作示例,你使用
进程
类使用
异步
事件,这样你也可以得到输出数据和错误

 Dim Proceso As New Process

 'Register Output async event
 AddHandler Proceso.OutputDataReceived, AddressOf CallbackProcesoAsync
 'Register error output async event
 AddHandler Proceso.ErrorDataReceived, AddressOf ErrorDataReceivedAsync

 Dim startInfo As New ProcessStartInfo
 startInfo.FileName = execFile
 startInfo.Arguments = CmdExeArguments
 startInfo.ErrorDialog = False
 startInfo.UseShellExecute = False

 Private Sub CallbackProcesoAsync(sender As Object, args As System.Diagnostics.DataReceivedEventArgs)

        If Not args.Data Is Nothing AndAlso Not String.IsNullOrEmpty(args.Data) Then
            'Do stuff with your output results    
        End If
 End Sub



  Private Sub CallbackProcesoAsync(sender As Object, args As System.Diagnostics.DataReceivedEventArgs)

        If Not args.Data Is Nothing AndAlso Not String.IsNullOrEmpty(args.Data) Then
         'Do stuff with error output

        End If
  End Sub

是否有任何小命令可以简单地在VB6页面(panal)上显示控制台的功能?=>我们可以在对话中显示excel表格