I need help fixing these errors in my visual basic homework
Posted: Fri Jul 08, 2022 6:35 am
I need help fixing these errors in my visual basic homework
monthlyBills.txt VB Electricity Project 2 B1 1 3 4 ▼ 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 26 27 28 29 30 31 32 33 34 35 100% Error List Entire Solution Application. Designer.vb Error List Output Public Class frmMain Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click Dim FILE_NAME As String = "monthlyBills.txt" Dim totalBillAmount As Double = 0 Dim averageBillAmount As Double = 0 Dim NUM_MONTHS As Integer = 12 Dim txtBill As String Else If System.IO.File. Exists(FILE_NAME) = True Then Dim fileReader As New System.IO.StreamReader(FILE_NAME) Do While fileReader. Peek() <> -1 txtBill= fileReader.ReadLine() totalBillAmount = totalBillAmount + Double.Parse(txtBill) Form1.vb* X Form1.vb [Design]* End If End Sub Loop End Sub ✔ No issues found averageBillAmount = totalBillAmount / NUM_MONTHS lblAvgBill.Text = "$" + average BillAmount.ToString("N2") End Class MessageBox.Show("File Does Not Exist") btnExit Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click frmMain. Active Form.Close() Code Description > BC30456 'Form1' is not a member of 'Electricity_Project_2'. ▷ ▸ IDE0059 Unnecessary assignment of a value to 'averageBillAmount' 1 Error A 0 Warnings ● 1 Message Build + IntelliSense - Click Ln: 32 File Ch: 5 Search Error List Project Electricity Projec... Application.Desi... 35 Electricity Projec... Form1.vb 6 SPC CRLF - д х D- Line Suppress Active Active
monthlyBills.txt VB Electricity Project 2 B1 1 3 4 ▼ 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 26 27 28 29 30 31 32 33 34 35 100% Error List Entire Solution Application. Designer.vb Error List Output Public Class frmMain Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click Dim FILE_NAME As String = "monthlyBills.txt" Dim totalBillAmount As Double = 0 Dim averageBillAmount As Double = 0 Dim NUM_MONTHS As Integer = 12 Dim txtBill As String Else If System.IO.File. Exists(FILE_NAME) = True Then Dim fileReader As New System.IO.StreamReader(FILE_NAME) Do While fileReader. Peek() <> -1 txtBill= fileReader.ReadLine() totalBillAmount = totalBillAmount + Double.Parse(txtBill) Form1.vb* X Form1.vb [Design]* End If End Sub Loop End Sub ✔ No issues found averageBillAmount = totalBillAmount / NUM_MONTHS lblAvgBill.Text = "$" + average BillAmount.ToString("N2") End Class MessageBox.Show("File Does Not Exist") btnExit Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click frmMain. Active Form.Close() Code Description > BC30456 'Form1' is not a member of 'Electricity_Project_2'. ▷ ▸ IDE0059 Unnecessary assignment of a value to 'averageBillAmount' 1 Error A 0 Warnings ● 1 Message Build + IntelliSense - Click Ln: 32 File Ch: 5 Search Error List Project Electricity Projec... Application.Desi... 35 Electricity Projec... Form1.vb 6 SPC CRLF - д х D- Line Suppress Active Active