Link to home
Start Free TrialLog in
Avatar of dearness
dearnessFlag for American Samoa

asked on

Why wont ASP.net listbox columns wont align

I am creating a form that has a ASP:listbox as a sales receipt containing three columns, I can not get the three column to align, I have the font set to Courier New, the text is being printed Ok, what could be wrong?
Sub printReceipt(ByVal array(), ByVal entries)
        Dim index As Integer
        'Format receipt list box with three columns, 30 x 40 x 20
        Dim strfmt As String = "{0,-30}{1,-40}{2,20}"
        'Clear out receipt list box
        lstReceipt.Items.Clear()
        'Print header for receipt list box
        Call initialiseListbox()
        'Print salse to receipt list box
        For index = 0 To entries - 1
            lstReceipt.Items.Add(String.Format(strfmt, array(index * 3), array(index * 3 + 1), array(index * 3 + 2)))
        Next
        'Print footer for receipt list box
        lstReceipt.Items.Add(String.Format(strfmt, "-------", "------", "----"))
        lstReceipt.Items.Add(String.Format(strfmt, "", "", "TOTAL: " & Session("total")))
    End Sub
 
    Sub initialiseListbox()
        Dim strfmt As String = "{0,-30}{1,-40}{2,20}"
        lstReceipt.Items.Add(String.Format(strfmt, "SPECIES", "WEIGHT", "COST"))
        lstReceipt.Items.Add(String.Format(strfmt, "-------", "------", "----"))
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Luke101
Luke101

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial