Solved

Why wont ASP.net listbox columns wont align

Posted on 2008-10-30
1
810 Views
Last Modified: 2012-05-05
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

0
Comment
Question by:dearness
1 Comment
 
LVL 1

Accepted Solution

by:
Luke101 earned 125 total points
ID: 22854924
I would try using tables. It's alot easier aligning colums with tables. See if that works
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now