It looks like you have introduced a few extra infinite looks while making the code changes. Have a look at the highlighted code below.
I was expecting your rest of the code to remain same except for those single line codes here and there I showed you in the previous post.
Code:Dim worker As System.ComponentModel.BackgroundWorker = DirectCast(sender, System.ComponentModel.BackgroundWorker) Dim intCount As Integer = 0 Do While intCount < 1 Loop myProcess = New Process Me.Label1.Text = "Run first command" Dim sid As String ' Start My process coding Dim sidIn As System.IO.StreamWriter = myProcess.StandardInput Dim sidOut As System.IO.StreamReader = myProcess.StandardOutput Dim sidErr As System.IO.StreamReader = myProcess.StandardError sidIn.AutoFlush = True sidIn.Write("Run First Command" & System.Environment.NewLine) sidIn.Write("exit" & System.Environment.NewLine) sid = sidOut.ReadToEnd() sidIn.Close() sidOut.Close() sidErr.Close() myProcess.Close() 'Increment intCount by 1 intCount += 1 If worker.CancellationPending Then e.Cancel = True Exit Sub End If Me.Label1.Text = "Edit the data" Dim sourcefile As String = IO.Path.Combine("Path") Dim rdrfile As IO.StreamReader = IO.File.OpenText(sourcefile) Dim strtemp() As String Dim FileLines As New List(Of String) Do While rdrfile.Peek <> -1 If worker.CancellationPending Then Exit Do FileLines.Add(rdrfile.ReadLine) Loop rdrfile.Close() Dim writer As IO.StreamWriter = New IO.StreamWriter(sourcefile, False) Dim Columns As New List(Of String) For Each Str As String In FileLines If worker.CancellationPending Then Exit For strtemp = Str.Split(" "c) If Trim(strtemp(0)) = "FILENO" Then writer.Write(strtemp(11).Trim & vbCrLf) Next For Each filtereditem As String In Columns If worker.CancellationPending Then Exit For writer.Write(filtereditem & vbCrLf) Next writer.Close() FileLines.Clear() Do While intCount < 1 Loop myProcess = New Process ' Start My process coding Dim smed As String Dim smedIn As System.IO.StreamWriter = myProcess.StandardInput Dim smedOut As System.IO.StreamReader = myProcess.StandardOutput Dim smedErr As System.IO.StreamReader = myProcess.StandardError smedIn.AutoFlush = True smedIn.Write("Run Second Command" & System.Environment.NewLine) smedIn.Write("exit" & System.Environment.NewLine) smed = smedOut.ReadToEnd() smedIn.Close() smedOut.Close() smedErr.Close() myProcess.Close() 'Increment intCount by 1 intCount += 1 If worker.CancellationPending Then e.Cancel = True Exit Sub End If Do While intCount < 1 Loop Me.Label1.Text = "Run Third Command" myProcess = New Process Dim sfre As String ' Start My process coding Dim sfreIn As System.IO.StreamWriter = myProcess.StandardInput Dim sfreOut As System.IO.StreamReader = myProcess.StandardOutput Dim sfreErr As System.IO.StreamReader = myProcess.StandardError sfreIn.AutoFlush = True sfreIn.Write("Run Third Command" & System.Environment.NewLine) sfreIn.Write("exit" & System.Environment.NewLine) sfre = sfreOut.ReadToEnd() sfreIn.Close() sfreOut.Close() sfreErr.Close() myProcess.Close() 'Increment intCount by 1 intCount += 1 If worker.CancellationPending Then e.Cancel = True Exit Sub End If Do While intCount < 1 Loop Me.Label1.Text = "Run Fourth Command" myProcess = New Process Dim scl As String Dim sclIn As System.IO.StreamWriter = myProcess.StandardInput Dim sclOut As System.IO.StreamReader = myProcess.StandardOutput Dim sclErr As System.IO.StreamReader = myProcess.StandardError sclIn.AutoFlush = True sclIn.Write("Run Fourth Command" & System.Environment.NewLine) sclIn.Write("exit" & System.Environment.NewLine) scl = sclOut.ReadToEnd() sclIn.Close() sclOut.Close() sclErr.Close() myProcess.Close() 'Increment intCount by 1 intCount += 1 If worker.CancellationPending Then e.Cancel = True Exit Sub End If Me.Label1.Text = "Edit the Data" Dim Open As String = IO.Path.Combine("Path") Dim Save As String = IO.Path.Combine("Path") Dim sb As New System.Text.StringBuilder Dim Lines = (From line In IO.File.ReadAllLines(Open) Where line.Length > 0 Select line).ToList For Each item In Lines If worker.CancellationPending Then Exit For Dim TempItem = item Dim Column1 = TempItem.Substring(0, TempItem.IndexOf(" ")) TempItem = TempItem.Replace(Column1, "").Trim Dim Column2 = TempItem.Substring(0, 20) TempItem = TempItem.Replace(Column2, "").Trim Dim Parts = System.Text.RegularExpressions.Regex.Replace(TempItem.TrimStart, " {2,}", ",").Replace(" ", ",").Split(","c) sb.AppendLine( String.Format("{0}{1}", Column1.PadRight(100, " "c), Column2.PadRight(100, " "c), )) Next IO.File.WriteAllText(Save, sb.ToString) Dim inputFile = Regex.Replace(IO.File.ReadAllText(Save), "[ ]{2,}", " ") IO.File.WriteAllText(Save, inputFile) If worker.CancellationPending Then e.Cancel = True




icon on the left of the post.
Reply With Quote