I am having an issue with naming buttons based on the line output. I can a message box to pop up with each line, however I would like to have each button named different lines of the output. Below is the code, any help would be appreciated.
vb.net Code:
Private Function nview_run() As Boolean Dim nview_runProcess As New Process() Dim nview_runStartInfo As New ProcessStartInfo() nview_runStartInfo.FileName = "cmd.exe " nview_runStartInfo.UseShellExecute = False nview_runStartInfo.CreateNoWindow = True nview_runStartInfo.Arguments = "/D /c net view" nview_runStartInfo.RedirectStandardOutput = True nview_runProcess.EnableRaisingEvents = True nview_runProcess.StartInfo = nview_runStartInfo nview_runProcess.Start() Dim output As String Dim readerStdOut As IO.StreamReader = nview_runProcess.StandardOutput output = readerStdOut.ReadToEnd() Dim lines() As String Dim line As String Dim pos As Integer lines = output.Split(vbCrLf) For Each line In lines line = line.Trim If line.StartsWith("\\") Then pos = line.IndexOf(" ") If pos > 0 Then line = line.Substring(0, pos) End If MessageBox.Show(line) End If Next End Function




Reply With Quote