473,657 Members | 3,021 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,"valu e="; remainingval
Next year
End Sub
thanks for any guidance.

Jul 17 '05 #1
2 7376
.... 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.
:
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 , , "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


Jul 17 '05 #3

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

Similar topics

0
1916
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 our client. One column which I would like to use is called 'used_by', which would store information about which business sections (Financial Management Branch, Human Resources Branch, etc.) use a particular application. Often
5
1691
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 you can get the events and overrides. But for some reason I can not seem to find the list of events and overrides for a C# form, if I do this. the Intelisense will show them but as for being able to select it and have the IDE pop the function or...
5
1804
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 property '.fulladdress' to be the value that appears in the drop downs text section. How to I set that parameter to be the one shown inthe drop down
1
1463
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 element of the array.. i know real basic.. 2nd.. where can i go to find methods of libxml2dom. i've been looking using google, but can't seem to find a site pointing out the underlying methods,
7
4463
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 to be checking that the correct data type is used DataAcess sets an abstract class and methods
4
1528
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
1558
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 basic outline of the program done which is: def Xref(filename): try: fp = open(filename, "r") lines = fp.readlines() fp.close()
6
38496
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 through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL command line interface
9
1599
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
1938
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 objects that I can iterate through relatively easily. I've included code at the bottom of this message. I can pretty easily iterate through my employee objects like so: Dim theEmployees As Employees = New Employees
0
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8601
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.