Answer to Question #189517 in Visual Basic for Vee

Question #189517

The Financial officer at RGI wants you to develop an application that will evaluate the company’s asset’s annual depreciation using the double-declining balance and sum-of-the years’ digit method. The Financial officer 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). The interface provides text boxes for entering the asset cost and salvage value. It also provides a list box for selecting the useful life, which ranges from 3 to 20 years. The depreciation amounts are displayed in the list boxes. Create a windows form application using the name RGI annual asset depreciation App. You can use the visual basic’s Financial.DDB method to calculate the double-declining balance depreciation and use its Financial.SYD method to calculate the sum-of-the-years’ digit depreciation. Both methods return the depreciation amount as double number


1
Expert's answer
2021-05-08T10:58:12-0400
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class RGIassetAnnualMainForm
    Inherits System.Windows.Forms.Form


    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub


    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer


    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.txtAssetCost = New System.Windows.Forms.TextBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.txtSalvageValue = New System.Windows.Forms.TextBox()
        Me.lstUsefulLife = New System.Windows.Forms.ListBox()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.btnDisplayDepreciationSchedules = New System.Windows.Forms.Button()
        Me.lstSumYearDigit = New System.Windows.Forms.ListBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.lstDoubleDecliningBalance = New System.Windows.Forms.ListBox()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(39, 35)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(59, 13)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Asset cost:"
        '
        'txtAssetCost
        '
        Me.txtAssetCost.Location = New System.Drawing.Point(127, 32)
        Me.txtAssetCost.Name = "txtAssetCost"
        Me.txtAssetCost.Size = New System.Drawing.Size(100, 20)
        Me.txtAssetCost.TabIndex = 0
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(39, 61)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(78, 13)
        Me.Label2.TabIndex = 0
        Me.Label2.Text = "Salvage value:"
        '
        'txtSalvageValue
        '
        Me.txtSalvageValue.Location = New System.Drawing.Point(127, 58)
        Me.txtSalvageValue.Name = "txtSalvageValue"
        Me.txtSalvageValue.Size = New System.Drawing.Size(100, 20)
        Me.txtSalvageValue.TabIndex = 1
        '
        'lstUsefulLife
        '
        Me.lstUsefulLife.FormattingEnabled = True
        Me.lstUsefulLife.Location = New System.Drawing.Point(298, 32)
        Me.lstUsefulLife.Name = "lstUsefulLife"
        Me.lstUsefulLife.Size = New System.Drawing.Size(128, 56)
        Me.lstUsefulLife.TabIndex = 2
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(236, 32)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(56, 13)
        Me.Label3.TabIndex = 0
        Me.Label3.Text = "Useful life:"
        '
        'btnDisplayDepreciationSchedules
        '
        Me.btnDisplayDepreciationSchedules.Location = New System.Drawing.Point(42, 99)
        Me.btnDisplayDepreciationSchedules.Name = "btnDisplayDepreciationSchedules"
        Me.btnDisplayDepreciationSchedules.Size = New System.Drawing.Size(384, 35)
        Me.btnDisplayDepreciationSchedules.TabIndex = 3
        Me.btnDisplayDepreciationSchedules.Text = "Display Depreciation Schedules"
        Me.btnDisplayDepreciationSchedules.UseVisualStyleBackColor = True
        '
        'lstSumYearDigit
        '
        Me.lstSumYearDigit.FormattingEnabled = True
        Me.lstSumYearDigit.Location = New System.Drawing.Point(239, 166)
        Me.lstSumYearDigit.Name = "lstSumYearDigit"
        Me.lstSumYearDigit.Size = New System.Drawing.Size(187, 173)
        Me.lstSumYearDigit.TabIndex = 1
        '
        'Label5
        '
        Me.Label5.AutoSize = True
        Me.Label5.Location = New System.Drawing.Point(236, 149)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(113, 13)
        Me.Label5.TabIndex = 0
        Me.Label5.Text = "Sum-of-the years' digit:"
        '
        'lstDoubleDecliningBalance
        '
        Me.lstDoubleDecliningBalance.FormattingEnabled = True
        Me.lstDoubleDecliningBalance.Location = New System.Drawing.Point(39, 166)
        Me.lstDoubleDecliningBalance.Name = "lstDoubleDecliningBalance"
        Me.lstDoubleDecliningBalance.Size = New System.Drawing.Size(187, 173)
        Me.lstDoubleDecliningBalance.TabIndex = 0
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.Location = New System.Drawing.Point(36, 149)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(130, 13)
        Me.Label4.TabIndex = 0
        Me.Label4.Text = "Double-declining balance:"
        '
        'frmMain
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(466, 361)
        Me.Controls.Add(Me.lstSumYearDigit)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.lstDoubleDecliningBalance)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.btnDisplayDepreciationSchedules)
        Me.Controls.Add(Me.lstUsefulLife)
        Me.Controls.Add(Me.txtSalvageValue)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.txtAssetCost)
        Me.Controls.Add(Me.Label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmMain"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "RGI Asset Annual Depreciation App"
        Me.ResumeLayout(False)
        Me.PerformLayout()


    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents txtAssetCost As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents txtSalvageValue As System.Windows.Forms.TextBox
    Friend WithEvents lstUsefulLife As System.Windows.Forms.ListBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents btnDisplayDepreciationSchedules As System.Windows.Forms.Button
    Friend WithEvents lstSumYearDigit As System.Windows.Forms.ListBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents lstDoubleDecliningBalance As System.Windows.Forms.ListBox
    Friend WithEvents Label4 As System.Windows.Forms.Label


End Class



Public Class RGIassetAnnualMainForm


    Private Sub RGIassetAnnualMainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For year As Integer = 3 To 20
            lstUsefulLife.Items.Add(year.ToString())
        Next
        lstUsefulLife.SelectedIndex = 0
    End Sub


    Private Sub btnDisplayDepreciationSchedules_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayDepreciationSchedules.Click
        Dim assetCost As Decimal
        Dim salvageValue As Decimal
        Dim usefulLife As Integer


        Decimal.TryParse(txtAssetCost.Text, assetCost)
        Decimal.TryParse(txtSalvageValue.Text, salvageValue)
        Integer.TryParse(lstUsefulLife.SelectedItem.ToString(), usefulLife)


        lstDoubleDecliningBalance.Items.Clear()
        lstSumYearDigit.Items.Clear()
        lstDoubleDecliningBalance.Items.Add("Year" + vbTab + vbTab + "Depreciation")
        lstSumYearDigit.Items.Add("Year" + vbTab + vbTab + "Depreciation")
        For year As Integer = 1 To usefulLife
            Dim depreciation As Decimal = Financial.DDB(assetCost, salvageValue, usefulLife, year)
            lstDoubleDecliningBalance.Items.Add(year.ToString() + vbTab + vbTab + depreciation.ToString("N"))
            depreciation = Financial.SYD(assetCost, salvageValue, usefulLife, year)
            lstSumYearDigit.Items.Add(year.ToString() + vbTab + vbTab + depreciation.ToString("N"))
        Next


    End Sub
End Class






Form



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS