Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click
If txtNumber.Text = "" Then
MessageBox.Show("Item Number is a Required Field")
ElseIf txtDescription.Text = "" Then
MessageBox.Show("Item Description is a Required Field")
ElseIf txtPurchase.Text = "" Then
MessageBox.Show("Item Purchase Date is a Required Field")
ElseIf txtPrice.Text = "" Then
MessageBox.Show("Item Donor is a Required Field")
ElseIf IsNumeric(txtPrice.Text) = False Then
MessageBox.Show("Item Pirce must be a numeric value")
ElseIf txtCurrent.Text = "" Then
MessageBox.Show("Current Item Price is a Required Field")
ElseIf IsNumeric(txtCurrent.Text) = False Then
MessageBox.Show("Current Item Price is a Required Field")
ElseIf txtLife.Text = "" Then
MessageBox.Show("Item Life is a Required Field")
ElseIf IsNumeric(txtLife.Text) = False Then
MessageBox.Show("Item Life is a Required Field")
ElseIf txtDepreciation.Text = "" Then
MessageBox.Show("Latest Depreciation Date is a Required Field")
Dim sr As IO.StreamReader = IO.File.OpenText("PersonalAssests.txt")
Dim sw As IO.StreamWriter = IO.File.CreateText("Temp.txt")
Dim updateItem As String = txtNumber.Text
Dim found As Boolean = False
lstOutput.Items.Add("Updated Record")
If updateItem <> data(0) Then
sw.WriteLine(txtNumber.Text & ", " & txtDescription.Text & ", " & txtProduct.Text & ", " & txtPurchase.Text & ", " & txtPrice.Text & ", " & txtCurrent.Text & ", " & txtLife.Text & ", " & txtDepreciation.Text)
lstOutput.Items.Add(txtNumber.Text & "," & txtDescription.Text & "," & txtProduct.Text & "," & txtPurchase.Text & ", " & txtPrice.Text & ", " & txtCurrent.Text & ", " & txtLife.Text & ", " & txtDepreciation.Text)
IO.File.Delete("PersonalAssests.txt")
IO.File.Move("Temp.txt", "PersonalAssests.txt")
lstOutput.Items.Add("Item Number was not found in the file")
txtDepreciation.Text = ""