A company has currently 6 sales staff (but we could have many more)that each sell to the east, west and central regions of canada. The data is in a text file called sales.txt in CSV format(use the split function shown in class to handle the CSV file). The fields(separated by commas) are salesperson name, sales in the east, west and central regions. Make up the file and save it along with your program. When the user clicks on a command button, input the file into 4 arrays called sname(), west sales(), centralsales() and eastsales() - you can assume that the number of employees can only rise up to 100. After that, a listbox shoudl be filled with a report in the format shown below. Note how the columns are right justified and also note that the totals are calculated and are not part of your text file.
Ok I got the file and everything in the program working except for getting the values listed in the table to be right justified. Right now they are crooked. Does anyone know how to fix this? Here is my code.
Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
Me.Hide()
End Sub
Private Sub btngenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btngenerate.Click
Dim fmtstr As String = "{0,-20} {1, 13:C0} {2,13:C0} {3,13:C0} {4,13:C0}"
Dim sname(100) As String
Dim eastsales(100), westsales(100), centralsales(100) As Double
Dim n, i As Integer
Dim lin, fields(3) As String
Dim sr As IO.StreamReader = IO.File.OpenText("sales.txt")
Dim easttot, westtot, centraltot, tottot, rowtot As Double
Do While sr.Peek <> -1
lin = sr.ReadLine
fields = lin.Split(",")