Solved

Why wont ASP.net listbox columns wont align

Posted on 2008-10-30
1
815 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

724 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