File writing output changes from machine to machine

66 Views Asked by At

I put together a vb.net program that does some string parsing and creates a fixed-width file at the end. When I run it on each of my 2 machines it creates a properly formatted file. When my client downloads the msi file, installs it, and runs it, he gets several extra spaces on each record of the file, and the number of spaces is inconsistent from record to record. Here is the code, although it runs fine on my side, so I am thinking it must have something to do with the compiler maybe???

'For each T2 record,
    For i = 0 To frmMain.SquirrelDataSet.PayDataExceptions.Rows.Count - 1

        frmMain.ProgressBar1.PerformStep()

        'Join Fname and Lname into FullName.
        Dim FullName As String = frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item("Lname") & "," & frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item("Fname")

        If FullName = Nothing Then
            FullName = ""
        End If
        'FullName = FullName(FullName.PadLeft(25, " "))
        FullName = FullName.PadLeft(25, " ")

        objWriter.Write(frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(0) & _
                        FullName & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(2) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(3) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(4) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(5) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(6) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(7) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(8) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(9) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(10) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(11) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(12) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(13) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(14) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(15) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(16) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(17) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(18) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(19) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(20) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(21) & _
                        frmMain.SquirrelDataSet.PayDataExceptions.Rows(i).Item(22) & vbCrLf)
    Next
1

There are 1 best solutions below

3
On

Most likely your client has extra whitespace in their data that is not present in your data.

You could try .Trim()ing the data before it is written.