Depreciation Calculator in Visual Basic
Option Strict On
Public Class frmDepreciation
‘Create Variables
Private intLifeSpan As Integer = 5I
Public Shared intArray As Integer = 7I
Public Shared strInventory(intArray) As String
Private strID(intArray) As String
Private decInitPrice(intArray) As Decimal
Private intQuantity(intArray) As Integer
Private Sub frmDepreciation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
‘Initialize I/O file
Dim objReader As IO.StreamReader
Dim strFile As String = “H:\My Documents\Visual Studio 2012\Projects\Depreciation\inventory.txt”
‘Declare variables
Dim intCount As Integer = 0I
‘Dim intFill As Integer
Dim strError As String = “The file is not available. Restart when the file is available.”
Dim frmList As New frmDisplay
‘Verify file
If IO.File.Exists(strFile) Then
objReader = IO.File.OpenText(strFile)
Try
‘Input file a line at a time
Do While objReader.Peek <> -1
‘shows message box when program begins and returns from second form