I'd like to see if anyone has any suggestions on making the following function faster or more efficient. This code segment reads data from a CVS file, breaks it up and writes the relevant data to a flat file. Some sample input would be:

Column A Column B
004-005 5
35 6
010-034 5


VB Code:
  1. Private Function createzonesFedEx(ByVal Filename As String, ByVal ShipType As String, ByVal Carrier As String)
  2.         Dim dash As Boolean 'determines whether or not the first column of numbers contain a dash
  3.         Dim i As Integer
  4.         Dim line As String 'line of data to be read
  5.         Dim commaArray() As String 'array of strings delimited by commas
  6.         Dim dashArray() As String ' array of strings delimited by dashes
  7.         Dim sr = New System.IO.StreamReader(Filename) ' I/O object to read data from Filename
  8.         Dim sw = New System.IO.StreamWriter(FILEPATH, True) 'I/O object to write data to FILEPATH
  9.  
  10.         line = sr.readline
  11.         While Not line Is Nothing
  12.  
  13.             commaArray = Split(line, ",")
  14.  
  15.             If (Mid(commaArray(0), 4, 1) = "-") Then
  16.                 dashArray = Split(commaArray(LBound(commaArray)), "-")
  17.                 dash = False
  18.             Else
  19.                 dash = True
  20.             End If
  21.  
  22.             For i = 0 To 7 Step 1
  23.                 Me.cboShipType.SelectedIndex = i
  24.                 Try
  25.                     sw.write(FRFIRM)
  26.                     sw.write(",")
  27.                     sw.write(Me.cboCarrier.Text)
  28.                     sw.write(",")
  29.                     sw.write(Me.cboShipType.Text)
  30.                     sw.write(",")
  31.                     sw.write(FVRSN)'Global constant
  32.                     sw.write(",")
  33.                     If (dash = False) Then
  34.                         sw.write(Format(Val(Trim(dashArray(0))), "000"))
  35.                         sw.write(",")
  36.                         sw.write(Format(Val(Trim(dashArray(1))), "000"))
  37.                         sw.write(",")
  38.                         sw.write(Format(Val(Trim(dashArray(1))), "000"))
  39.                     Else
  40.                         sw.write(Format(Val(Trim(commaArray(0))), "000"))
  41.                         sw.write(",")
  42.                         sw.write(Format(Val(Trim(commaArray(0))), "000"))
  43.                         sw.write(",")
  44.                         sw.write(Format(Val(Trim(commaArray(0))), "000"))
  45.                     End If
  46.                     sw.write(",")
  47.                     sw.write(FRSTA)'Global constant
  48.                     sw.write(",")
  49.                     sw.write(Now.Today.ToString("yyyyMMdd"))
  50.                     sw.write(",")
  51.                     sw.write(Now.Today.ToString("yyyyMMdd"))
  52.                     sw.write(",")
  53.                     sw.write(FRZAEN)'Global constant
  54.                     sw.write(",")
  55.                     sw.write(FRUSER)'Global constant
  56.                     sw.write(",")
  57.                     sw.writeline(FRWSID)'Global constant
  58.                     sw.newline()
  59.                 Catch ex As Exception
  60.                     MessageBox.Show(ex.Message)
  61.                 End Try
  62.             Next
  63.             line = sr.readline
  64.         End While
  65.         Me.cboShipType.SelectedIndex = -1
  66.         sw.Close()
  67.     End Function

This works fine, I just think it could be done better. Any suggestions? Thank you for your time.