I am trying to express the code below into a better approach. I tried to use an array but was unsuccessful.
Thank you very much for taking time to read this post,
Gr8life
ConvertFiles(inFile, outFile1, outFile2, outFile3, outFile4, outFile5, outFile6, outFile7, outFile8, outFile9, outFile10, outFile11, outFile12, outFile13, outFile14, outFile15, outFile16, outfile17, outfile18)
If ((outFile1.Length > 0) And (outFile2.Length > 0) And (outFile3.Length > 0) And (outFile4.Length > 0) And (outFile5.Length > 0) And (outFile6.Length > 0) And (outFile7.Length > 0) And (outFile8.Length > 0) And (outFile9.Length > 0) And (outFile10.Length > 0) And (outFile11.Length > 0) And (outFile12.Length > 0) And (outFile13.Length > 0) And (outFile14.Length > 0) And (outFile15.Length > 0) And (outFile16.Length > 0) And (outfile17.Length > 0) And (outfile18.Length > 0)) Then
Bigger picture:
Dim startDT As DateTime = DateTime.Now
If (inFile.Length > 0) Then
Button1.Visible = False
ConvertFiles(inFile, outFile1, outFile2, outFile3, outFile4, outFile5, outFile6, outFile7, outFile8, outFile9, outFile10, outFile11, outFile12, outFile13, outFile14, outFile15, outFile16, outfile17, outfile18)
End If
If ((outFile1.Length > 0) And (outFile2.Length > 0) And (outFile3.Length > 0) And (outFile4.Length > 0) And (outFile5.Length > 0) And (outFile6.Length > 0) And (outFile7.Length > 0) And (outFile8.Length > 0) And (outFile9.Length > 0) And (outFile10.Length > 0) And (outFile11.Length > 0) And (outFile12.Length > 0) And (outFile13.Length > 0) And (outFile14.Length > 0) And (outFile15.Length > 0) And (outFile16.Length > 0) And (outfile17.Length > 0) And (outfile18.Length > 0)) Then
Dim stopDT As DateTime = DateTime.Now
Dim elapsedTS As TimeSpan = stopDT.Subtract(startDT)
Dim msg As String = elapsedTS.Hours & "h" & elapsedTS.Minutes & "m" & elapsedTS.Seconds & "s" & elapsedTS.Milliseconds & "ms"
MessageBox.Show("File Complete!" & ControlChars.CrLf & ControlChars.CrLf & "Process Duration:" & ControlChars.CrLf & msg)
Button1.Visible = True
Button1.Enabled = True
Else
MsgBox("No output file specified!")
End If
Catch ex As Exception
MsgBox("Error in Button1_Click :" & ex.Message)
End Try
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.