Examlex

Solved

The Following Sample of Code Contains Errors

question 25

Essay

The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
-Private Sub btnDisplay_Click(ByVal sender As Object,ByVal e As System.EventArgs)Handles btnDisplay.Click
' display the contents of the students.txt file
' declare variables
Dim inFile As IO.StreamWriter
Dim strStudent As String
' clear previous students from the Students box
lblStudents.Text = String.Empty
' determine whether the file exists
If IO.Exists("students.txt")= True Then
' open the file for input
inFile = IO.File.ReadText("students.txt")
' process loop instructions until end of file
Do Until inFile.Peek <> -1
' read a student line
strStudent = inFile.ReadLine
' display the student
lblStudents.Text = lblStudents.Text &
strStudent & ControlChars.NewLine
Loop
' close the file
Me.Close()
Else
MessageBox.Show("File not found","Students",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
End Sub


Definitions:

Total Expenses

Total Expenses refer to the aggregate amount of all operational, administrative, and financial costs incurred by a business during a specific period.

Total Assets

The sum of all resources owned by a company, valued at cost or market value, which include both current and non-current assets.

Electric Bill

A monthly statement charging for the consumption of electrical power provided by a utility company.

Total Expenses

The sum of all costs incurred by a business or individual in a specific period.

Related Questions