I will not that the code below
shall count up or down

'********************************* Sumtax
  For lngIndex2 = 1 To ListView1.ListItems.Count
        lngTot2 = lngTot2 + ListView1.ListItems(lngIndex2).SubItems(5)
   Next
       Text10.Text = Format(lngTot2, "###0.00")

if I have say 83.67 in a listview
then in the text10.text shall
be the same amount no differens
text10.text = 83.67

Recommended Answers

Firstly, the syntax at line 2 & 3 are wrong. It synax would be

For lngIndex2 = 0 To ListView1.ListItems.Count-1
    lngTot2 = lngTot2 + Val(ListView1.Items(lngIndex2).SubItems(5).Text)
Next

More consizely, it should be

For lngIndex2 = 0 To ListView1.ListItems.Count-1
    lngTot2 += Val(ListView1.Items(lngIndex2).SubItems(5).Text)
Next

To …

Jump to Post

All 3 Replies

Firstly, the syntax at line 2 & 3 are wrong. It synax would be

For lngIndex2 = 0 To ListView1.ListItems.Count-1
    lngTot2 = lngTot2 + Val(ListView1.Items(lngIndex2).SubItems(5).Text)
Next

More consizely, it should be

For lngIndex2 = 0 To ListView1.ListItems.Count-1
    lngTot2 += Val(ListView1.Items(lngIndex2).SubItems(5).Text)
Next

To show your result the code is

Text10.Text = Format(lngTot2, "0.00")

Hi

It dosn't help

Hi

When I renove the + sign it works perfect

Thank's for the help

Be a part of the DaniWeb community

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