dearness
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.