?
Solved

Why wont ASP.net listbox columns wont align

Posted on 2008-10-30
1
Medium Priority
?
818 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 375 total points
ID: 22854924
I would try using tables. It's alot easier aligning colums with tables. See if that works
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

801 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