Solved

Why wont ASP.net listbox columns wont align

Posted on 2008-10-30
1
811 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

896 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

16 Experts available now in Live!

Get 1:1 Help Now