Order form help please

jimmypop

Member
Joined
Feb 18, 2005
Messages
7
Programming Experience
Beginner
I'm trying to configure an order form to print out correctly. There's a couple of things I am having issues with.

1. I need to make a user prompt when the form first loads to remind the user to enter their name and credit card number.

2. The format of the order itself in the listbox is all messed up

it's supposed to look like this
Customer: (name goes here)
Acct. #: (account number here)


Valentine Gift Order

ID Item Name Quantity Price Total
================================================
AB-11 Ring 1 200.00 200.00
CD-32 Watch 2 50.00 100.00
EF-44 Chocolate 2 25.00 50.00

Total 350.00
Tax 7% 24.50
Order Total $374.50

Number of categories ordered: 3
Number of items ordered: 5

but I can't get to anything close to that. I have the form built I just have no idea how it get the info into the listbox. (for some reason the actual post isn't lining up, hopefully you get the idea...today is not my day)

thanks
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
1. In your form load : messagebox.show("Your user prompt")

2. How's it messed up? (wrapping the text maybe...)

TPM
 

jimmypop

Member
Joined
Feb 18, 2005
Messages
7
Programming Experience
Beginner
I just can't get it show correctly in the listbox.

qty = CDbl(TxtQty.Text)
price = CDbl(TxtPrice.Text)
total = qty * price
grandtotal = grandtotal + total


lstOutput.Items.Add(String.Format(frmstr, item, itemname, qty, price, total))
lstOutput.Items.Add("The grand total is " & grandtotal)
lstOutput.Items.Add("The grand total plus tax is " & tax(grandtotal) + grandtotal)


Dim price, qty, total, grandtotal As Double
Dim item, itemname, As String
Dim frmstr As String = "{0, -10}{1, 10}{2, 15}{3, 15:n2}{4, 15:c2}"

does that help you see where i'm lost at? thanks
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Well your using things before you've Dim'ed them, but I'm assuming that's just how you pasted it in. Your frmstr is wrong.
It should be ="{0} - {1} {2} {3:c} {4:c}"
String.format( frmstr, ID, Item, ItemName, Qty, Price, Total )
 
Last edited:

jimmypop

Member
Joined
Feb 18, 2005
Messages
7
Programming Experience
Beginner
I got ya :).

How do I get column headers to post without them repeating?
right now I have this

lstOutput.Items.Add(String.Format(frmstr, "ID", "Item Name", "Quantity", "Price", "Total"))
lstOutput.Items.Add(String.Format(frmstr, item, itemname, qty, price, total))
lstOutput.Items.Add("The grand total plus tax is " & tax(grandtotal) + grandtotal)

When I click my button the headers repeat, do I have this in the wrong place?

and when I'm done with my order how do I get the sub total, tax and grand total to print only once? will I have to make a new button to do this function?
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
VB.NET:
lstOutput.Items.Add("ID Item Name Quantity Price Total)' don't use the format here
 
'loop through the items in the basket
lstOutput.Items.Add(String.Format(frmstr, item, itemname, qty, price, total))
'next

lstOutput.Items.Add("The grand total plus tax is " & tax(grandtotal) + grandtotal)
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Well you have a list of things that are being purchased right. You want to loop through that list and add each item.
 

jimmypop

Member
Joined
Feb 18, 2005
Messages
7
Programming Experience
Beginner
right, i think. i want the customer to choose whatever they need and have it show up in the list box under the headers. each time i do that the headers show up along with the item they chose. . i'm not sure what a loop is though
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Ok say your items are in an arraylist you'd do this:
VB.NET:
Sub fillLstOutput
dim i as integer = 0
lstOutput.Items.clear()
lstOutput.Items.Add("ID Item Name Quantity Price Total)' don't use the format here
 
While i < ItemsArrrayList.count
'set item, itemname, qty, price, total to the coresponding values for the item
lstOutput.Items.Add(String.Format(frmstr, item, itemname, qty, price, total))
Endwhile

lstOutput.Items.Add("The grand total plus tax is " & tax(grandtotal) + grandtotal)
end sub
 
Top Bottom