.... in a listbox ...
Private Sub Command2_Click( )
salvage = 200
life = 10
cost = CDbl(Text1)
For year = 1 To 10
depreciation = DDB(cost, salvage, life, year)
totaldepr = (depreciation + totaldepr)
remainingval = (cost - totaldepr)
List1.AddItem depreciation & vbTab & _
year & vbTab & _
totaldepr & vbTab & _
remainingval
Next year
End Sub
.... in a listview ...
Private Sub Form_Load()
With ListView1
.ColumnHeaders. Add , , "depreciati on"
.ColumnHeaders. Add , , "for year"
.ColumnHeaders. Add , , "total depriciation"
.ColumnHeaders. Add , , "Value"
.FullRowSelect = True
.HideSelection = False
.LabelEdit = lvwManual
.View = lvwReport
End With
End Sub
Private Sub Command3_Click( )
Dim itmx As ListItem
salvage = 200
life = 10
cost = CDbl(Text1)
For year = 1 To 10
depreciation = DDB(cost, salvage, life, year)
totaldepr = (depreciation + totaldepr)
remainingval = (cost - totaldepr)
Set itmx = ListView1.ListI tems.Add(, , depreciation)
itmx.SubItems(1 ) = year
itmx.SubItems(2 ) = totaldepr
itmx.SubItems(3 ) = remainingval
Next year
End Sub
--
Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.
"nkp" <we***********@ btinternet.com> wrote in message
news:bo******** **@sparta.btint ernet.com...
: ...trying to get the following result into a list box.
: Dim cost As Double
: Dim salvage As Double
: Dim life As Double
: Dim year As Double
: Dim factor As Variant
: Dim depreciation As Double
: Dim totaldepr As Double
: Dim remainingval As Double
:
:
: Private Sub Command1_Click( )
: salvage = 200
: life = 10
: cost = CDbl(Text1)
: For year = 1 To 10
: depreciation = DDB(cost, salvage, life, year)
: totaldepr = (depreciation + totaldepr)
: remainingval = (cost - totaldepr)
:
: Print depreciation, "for year", year, "total
: depriciation="; totaldepr,"valu e="; remainingval
: Next year
: End Sub
:
:
: thanks for any guidance.
: