Math issues and listboxes...

[code]’ Primary Variable Declaration(s)
Var curSubTotal As Currency
Var curPrice As Currency
Var iCnt As Integer

’ Function(s) / Logic…
For i As Integer = 0 To lstBxOrder.LastRowIndex
curPrice = lstBxOrder.CellValueAt( 3 ).ToDouble
iCnt = lstBxOrder.CellValueAt( 2 ).ToInteger
curPrice = curPrice * iCnt

curSubTotal = curSubTotal + curPrice

Next

txtSubTotal.Value= curSubTotal.ToText[/code]

Pretty straight forward… right? Apparently not. So here’s the deal. I have a ListBox that holds all the selected products for purchase. I have set up one column to be edited (it’s the one for quantity of items) then once the edit is completed I have a Method (see code above) that is supposed to loop through the ListBox contents and multiply the number of items ( CellValueAt( 2 ).ToInteger ) times the price of the item ( CellValueAt( 3 ).ToDouble ) then update the TextField that displays the Sub-Total value.

I am getting the following errors:

frmActiveTill.mthSubTotalCalc, line 20
There is more than one method with this name but this does not match any of the available signatures.
curPrice = lstBxOrder.CellValueAt( 3 ).ToDouble

frmActiveTill.mthSubTotalCalc, line 20
This method extends type String, but the base expression is type Int32.
curPrice = lstBxOrder.CellValueAt( 3 ).ToDouble

frmActiveTill.mthSubTotalCalc, line 21
There is more than one method with this name but this does not match any of the available signatures.
iCnt = lstBxOrder.CellValueAt( 2 ).ToInteger

frmActiveTill.mthSubTotalCalc, line 21
This method extends type String, but the base expression is type Int32.
iCnt = lstBxOrder.CellValueAt( 2 ).ToInteger

The Line numbers refer to these two lines here:
20 = curPrice = lstBxOrder.CellValueAt( 3 ).ToDouble
21 = iCnt = lstBxOrder.CellValueAt( 2 ).ToInteger

What am I doing incorrectly?

You haven’t given a row number in:

curPrice = lstBxOrder.CellValueAt( 3 ).ToDouble

Presumably it should be:

curPrice = lstBxOrder.CellValueAt( i, 3 ).ToDouble

Oh, well that is a problem… now isn’t it!? And now it works! So off I go to break something else!

Thanks!