Solved

Why wont ASP.net listbox columns wont align

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

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…
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 …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

733 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