Quote:
Dim counteritem As Integer
Dim counter As Integer
Dim myvar As String
Dim num As Integer
Dim D As Double
Dim P As Double
Dim V As Double
Dim iprice As Integer
Dim itotal As Double
CALCULATION BIT THAT NEEDS SORTING OUT:
Private Sub cmdcal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcal.Click
counteritem = lstboxpric.Items.Count - 1
For counter = 0 To counteritem
myvar = lstboxpric.Items.Item(Int(counter))
If myvar = D Then
num = D
itotal = itotal + num
BVAT.Text = "£ " & itotal
End If
If myvar = V Then
num = V
itotal = itotal + num
BVAT.Text = "£ " & itotal
End If
If myvar = P Then
num = P
itotal = itotal + num
BVAT.Text = "£ " & itotal
End If
Next
itotal = 0
End Sub
'This is the prices D = dvd V = video P = Playstation the prices are followed after the equals
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
D = 3.25
V = 2.55
P = 1.55
End Sub
'This is the values that are added in the list box ready for calculation.
Private Sub cmdadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.Click
lstboxname.Items.Add(lbl1.Text)
If lbl2.Text = 3.25 Then
lstboxpric.Items.Add(D)
ElseIf lbl2.Text = "2.55" Then
lstboxpric.Items.Add(V)
ElseIf lbl2.Text = "1.55" Then
lstboxpric.Items.Add(P)
End If
End Sub
My problem is that all the adding works so that if the 3.25 and 2.55 are in the lstboxpric the BVAT.text would come up with £6 instead of being£5.80 (i no for definate that it is rounding the sums up i have tried so many times) can any one see what i am doing wrong :).. thank you so much for reading this :) i appreciate it :).