I am developing a form that calculates a Business Travel Expense for a business trip. Everything is fine and dandy but I have to display the information in a listbox using zone ouput. There is nothing in my book about zone output...the teacher provided us with this

Dim fmtStr As String = "{0, -18}{1, 10}"

1stResult.Items.Add ( String.Format ( fmtStr, "Price/Book:", FormatCurrency(unitPrice, 2)))

If I understand correctly the first line is simply setting up columns to display the information however I have no idea what the second line is doing and how to implement it into my program to make my output correct.

The output of my program should be:

Business Travel Expense

Trip to attend meeting of
Association for Computing macinery
Feb 27 - Mar 3 in Kovington

Meals and Entertainment      $190.10
Airplane Fare                $210.15
Lodging                      $475.35
Taxi Fares                    $35.00
           Total Other than Meals and Entertainment:    $720.50
                     50% of Meals and Entertainment:     $95.05

I have all of the subs and functions set up to receive this information and determine the total I just don't know how to display it like the above in a listbox using what was provided.

Let's look at fmtstr first.

"{0, -18}{1, 10}"

This says you want to format two items. The first item will be in a field that is 18 character wide. If you specified 18 (positive number) the text would be right justified in the field. Because is is given as -18 (negative), the data is displayed left justified in the field. The second output field is 10 chars wide and the number will be displayed right justified.

FormatCurrency takes a number and displays it with a "$" at the left and with the specified number of decimal places (in your case, 2).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.