Solved

Problems with list box and Zone Output

Posted on 2009-03-30
2
211 Views
Last Modified: 2012-05-06
I am trying to set up a list box population when a button is clicked. As I started to enter the headers all that shows up is the first entry repeated 5 times.

I attached a picture of what the output looks like on the button click and the code I used.

Any help would be appreciated, This is driving me nuts!
Thanks!

Private Sub displayStockBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles displayStockBtn.Click
        Dim fmtStr As String = "{0,-25}{0,15:N0}{0,15}{0,15:N3}{0,15:N2}"
        lstOutput.Items.Clear()
        lstOutput.Items.Add(String.Format(fmtStr, "", "Number", "Date", "Purchase", "Current"))
        lstOutput.Items.Add(String.Format(fmtStr, "Stock", "of Shares", "Purchased", "Price/Share", "Price/Share"))
        lstOutput.Items.Add(String.Format(fmtStr, "====================", "==========", "==========", "==========", "=========="))
    End Sub

Open in new window

output.bmp
0
Comment
Question by:Cloud_Sublime
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 125 total points
ID: 24018225
Your string pattern should look like this....

    Dim fmtStr As String = "{0,-25}{1,15:N0}{2,15}{3,15:N3}{4,15:N2}"

Wayne
0
 

Author Closing Comment

by:Cloud_Sublime
ID: 31564301
Thanks for catching that!!! Man I feel quite sheepish...been messing with that for an hour or so now! Ahh well chalk that one up as a learning experience! :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

808 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