掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
標準出力をテキストボックスに割り当てるには? (ID:142039)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
OutputDataReceived イベントを試してみてください。 Public Class Form1 Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim psi As New ProcessStartInfo() psi.FileName = Environ("ComSpec") psi.RedirectStandardInput = False psi.RedirectStandardOutput = True psi.UseShellExecute = False psi.CreateNoWindow = False 'True psi.Arguments = "/C DIR ""C:\Program Files\""" psi.ErrorDialog = True TextBox1.Clear() Dim p As Process = Process.Start(psi) AddHandler p.OutputDataReceived, AddressOf Received p.BeginOutputReadLine() End Sub Delegate Sub AppendTextInvoker(ByVal S As String) Private Sub Received(ByVal sender As Object, ByVal e As DataReceivedEventArgs) If e.Data IsNot Nothing Then BeginInvoke(New AppendTextInvoker(AddressOf TextBox1.AppendText), e.Data & vbCrLf) End If End Sub End Class
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.