troubleshooting Question

Array Help

Avatar of gr8life
gr8life asked on
Visual Basic.NET
6 Comments1 Solution174 ViewsLast Modified:
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
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros