Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I fix the below errors in Visual Basic? BC30491 Expression does not produce a value This error is showing up six times. Below

How do I fix the below errors in Visual Basic?

BC30491 Expression does not produce a value

This error is showing up six times. Below is my code. I have bolded the text and added astericks to the line that is being called out in visual basic as an error (that it underlines in red).

PLEASE DO NOT PROVIDE A BASIC/DEFAULT ANSWER. I NEED TO RESOLVE MY OWN CODING ERRORS BASED ON MY CODE SO I CAN LEARN.

THANK YOU.

Public Class frm AutomotiveBill Const OilChange As Double = 26 Const LubeJob As Double = 18 Const RadiatorFlush As Double = 30 Const TransmissionFlush As Decimal = 80 Const Inspection As Decimal = 15 Const MufflerReplacement As Decimal = 100 Const TireRotation As Decimal = 20

Private Sub OilLubeCharges() Dim total As Double = 0

If cboOilChange.Checked = True Then total += OilChange ElseIf cboLubeJob.Checked Then total += LubeJob End If End Sub

Private Sub FlushCharges() Dim total As Double = 0 If cboRadiatorFlush.Checked = True Then total += RadiatorFlush ElseIf cboTransmissionFlush.Checked Then total += TransmissionFlush End If End Sub

Private Sub MiscCharges() Dim total As Double = 0 If cboInspection.Checked = True Then total += Inspection ElseIf cboReplaceMuffler.Checked Then total += MufflerReplacement ElseIf cboTireRotation.Checked Then total += TireRotation End If End Sub

Private Sub OtherCharges(ByVal parts As Double, ByVal labor As Double) Dim OtherCharges As Double = parts + labor End Sub

Private Sub TaxCharges(ByVal partsValue As Double) Dim saleTax As Double saleTax = partsValue * 0.06 End Sub

Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click

lblPartsCharges.Text = String.Empty lblServiceAndLaborCharges.Text = String.Empty lblTaxCharges.Text = String.Empty lblTotalFeesCharges.Text = String.Empty Dim Service_Labor As Double = 0 Dim salesTax As Double = 0 Dim Charges As Double = 0 Dim parts As Double = 0 Dim labor As Double = 0 Dim total As Double parts = CDec(txtParts.Text) labor = CInt(txtLabor.Text)

If parts >= 0 Then salesTax = TaxCharges(parts) ' ************************** Else parts = 0 salesTax = 0 MessageBox.Show("Parts value cannot be negative", "Warning") End If If labor >= 0 Then Charges = OtherCharges(parts, labor) ' ************************** Else labor = 0.0 Charges = OtherCharges(parts, labor) ' ************************** MessageBox.Show("Labor value cannot be negative", "Warning") End If 'Call appropriate Functions and add the return values of functions and store it to variable Service_Labor Service_Labor = OilLubeCharges() + FlushCharges() + MiscCharges() + Charges ' ************************** lblServicesAndLabor.Text = Service_Labor.ToString("C") lblPartsCharges.Text = parts.ToString("C") lblTaxCharges.Text = salesTax.ToString("C") total = Service_Labor + parts + salesTax lblTotalFeesCharges.Text = total.ToString("C") End Sub

Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click Me.Close()

End Sub

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

End Sub End Class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions