我整理了一个 vb.net 程序,它进行一些字符串解析并在最后创建一个固定宽度的文件。当我在两台机器上运行它时,它会创建一个格式正确的文件。当我的客户下载 msi 文件,安装并运行它时,他在文件的每条记录上获得了几个额外的空格,并且每个记录的空格数不一致。这是代码,虽然它在我这边运行良好,所以我认为它可能与编译器有关?
'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