473,503 Members | 9,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Basic List Box question

nkp
....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,"value="; remainingval
Next year
End Sub
thanks for any guidance.

Jul 17 '05 #1
2 7371
.... 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 , , "depreciation"
.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.ListItems.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.btinternet.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,"value="; remainingval
: Next year
: End Sub
:
:
: thanks for any guidance.
:
Jul 17 '05 #2
nkp
Randy...you're a star.Thanks very much.
Best wishes

N

Randy Birch wrote:
... 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 , , "depreciation"
.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.ListItems.Add(, , depreciation)
itmx.SubItems(1) = year
itmx.SubItems(2) = totaldepr
itmx.SubItems(3) = remainingval

Next year

End Sub


Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1904
by: James Walters | last post by:
Hello, DB novice checking in here with a basic design question. I have a table called 'nms_apps' which stores information about all of our applications which we have developed/maintained for...
5
1683
by: ECVerify.com | last post by:
This should be a basic question. In VB.NET in the two drop downs over the source code for a form you can get a list of the events and overrides for that form. In VC++ in the properties window...
5
1800
by: Aussie Rules | last post by:
Hi, Having a mental block on this one. Have done it before but can't rack my brain on how... I have an object, with a bunch on property, and I add that object to a combo box. I want the...
1
1458
by: bruce | last post by:
hi... i have the following test python script.... i'm trying to figure out a couple of things... 1st.. how can i write the output of the "label" to an array, and then how i can select a given...
7
4453
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears...
4
1517
by: Schüle Daniel | last post by:
Hello, first question In : cmp("ABC",) Out: 1 against what part of the list is the string "ABC" compared? second question
21
1542
by: nateastle | last post by:
I have a simple assignment for school but am unsure where to go. The assignment is to read in a text file, split out the words and say which line each word appears in alphabetical order. I have the...
6
38451
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
9
1587
by: Peskov Dmitry | last post by:
It is a very basic question.Surely i got something wrong in my basic understanding. //Contents of file1.cpp using namespace std; #include <iostream> template <typename T> class my_stack;
3
1927
by: Scott Stark | last post by:
Hello, I'm trying to get a better handle on OOP programming principles in VB.NET. Forgive me if this question is sort of basic, but here's what I want to do. I have a collection of Employee...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.