The accountant at Sonheim Manufacturing Company wants an application that calculates an asset’s annual depreciation. The accountant will enter the asset’s cost, useful life (in years), and salvage value (which is the value of the asset at the end of its useful life). Use a list box to display the useful life, which should range from 3 through 20 years. The application should use the double-declining balance method to calculate the annual depreciation amounts; it then should display the amounts in the interface.
You can use the Financial.DDB method to calculate the depreciation. The method’s syntax is Financial.DDB(cost, salvage, life, period). In the syntax, the cost, salvage, and life arguments are the asset’s cost, salvage value, and useful life, respectively. The period argument is the period for which you want the depreciation amount calculated. The method returns the depreciation amount as a Double number. Figure 6-68 shows a sample depreciation schedule for an asset with a cost of $1000, a useful life of 4 years, and a salvage value of $100. Create a Visual Basic Windows application. Use the following names for the solution and project, respectively: Sonheim Solution and Sonheim Project. Save the application in the VB2012Chap06 folder. Change the form file’s name to Main Form.vb. Change the form’s name to frmMain. Create the interface shown in Figure 6-68. Set the txtSchedule control’s Multiline and ReadOnly properties to True, and set its ScrollBars property to Vertical. Code the application. Save the solution and then start and test the application. Close the Code Editor window and then close the solution.