Solved

Problems with list box and Zone Output

Posted on 2009-03-30
2
212 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

680 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