|
-
Nov 16th, 2009, 12:26 PM
#1
Thread Starter
New Member
please help!!!
Hi Hope you can help because its driving me up the wall.
I've made a program that can add 4 items in a row in a list box, for instance
Item Make Guarentee qty Price
toy car rover 1 1 £45.00
monkey monkey 2 1 £65.00
total: £100.00
The problem is I can't get the price to total up in a lable or textbox, however,
I can make it work if i seperate the box and make two, listbox1 for item,make,gtee, qty and listbox 2 for price only.
I don't want this because i want the row to delete in one go instead of deleting it from two boxes which is a time taker. code below
I've worked out how to delete and make it add up right its just the two boxes i cant get my head around.
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim Model As String
Dim Make As String
Dim Guarantee As Integer = 0
Dim price As Double = 0
Dim qty As Integer = 0
Dim Discount As Double = 0
Dim DelCharge As Double = 0
Dim Subtotal As Double = 0
Dim total As Double = 0
Dim totalpayment As Double = 0
'find user input and assign values to their variables
Model = (ModelNotextbox.Text)
Make = (Maketextbox.Text)
Guarantee = Val(Guaranteecombobox.Text)
price = Val(Pricetextbox.Text)
qty = Val(Qtytextbox.Text)
'Price * qty
totalpayment = price * qty
'display data in list box
ListBox1.Items.Add(Model & ControlChars.Tab & ControlChars.Tab & Make & ControlChars.Tab & Guarantee & ControlChars.Tab & qty & ControlChars.Tab)
ListBox2.Items.Add(String.Format("{0:c}", totalpayment))
'Adds list box prices together *
Dim totals As Integer
For Each value As Double In ListBox2.Items
totals += value
Next
Label28.Text = (String.Format("{0:c}", totals))
'Clear previous items
ModelNotextbox.Clear()
Maketextbox.Clear()
Guaranteecombobox.Refresh()
Pricetextbox.Clear()
End Sub
Thanks alot for the help!
-
Nov 16th, 2009, 12:29 PM
#2
Re: please help!!!
FYI, you are posting .Net related code/questions in the VB6 forum. And you should not post the same question multiple times.
A moderator may be along soon to move both of your threads to the correct forum.
-
Nov 16th, 2009, 12:32 PM
#3
Thread Starter
New Member
Re: please help!!!
 Originally Posted by LaVolpe
FYI, you are posting .Net related code/questions in the VB6 forum. And you should not post the same question multiple times.
A moderator may be along soon to move both of your threads to the correct forum.
sorry I didn't know, I'm new to this..
-
Nov 16th, 2009, 12:39 PM
#4
Thread Starter
New Member
Re: please help!!!
the forum sub title says vb 6 and ealier how is it vb.net
-
Nov 16th, 2009, 12:53 PM
#5
Re: please help!!!
 Originally Posted by TheCodeHunter
the forum sub title says vb 6 and ealier how is it vb.net
You will not see the following System parameter types in VB6:
ByVal sender As System.Object, ByVal e As System.EventArgs
Also, the control names and class names used in your code is a dead giveaway.
Edited: VB6 is about a decade older than .Net
Last edited by LaVolpe; Nov 16th, 2009 at 12:59 PM.
-
Nov 16th, 2009, 12:57 PM
#6
Re: please help!!!
Thread moved from 'VB6 and Earlier' forum to 'VB.Net' (VB2002 and later) forum
Also, please post each question (or variation of it) only once - I have deleted all of the duplicates you posted (even the ones you made after LaVolpe asked you not to do it).
-
Nov 16th, 2009, 12:59 PM
#7
Thread Starter
New Member
Re: please help!!!
well i'm still learning to suck eggs when it comes to coding, could you be of any help with this? ty
-
Nov 16th, 2009, 01:08 PM
#8
Fanatic Member
Re: please help!!!
a simple search on the forum could possibly steer you in the correct direction.
anyhoo, kevininstructor just recently posted an excellent way to handle this on another post.
http://www.vbforums.com/showpost.php...73&postcount=3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|