Solved

Problems with list box and Zone Output

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now