I am currently working on a project called TG automotive. It is a simple form with pretty basic calculations. I have the program running flawlessly except for the validation. I am supposed to have a function that tests to make sure inputs are numeric and not negative. I have written the function, i just cannot seem to figure out how to actually implement it in the program. Any tips or suggestions greatly appreciated. The ValidateInputs() is the function i created that i need to implement. Here is the full code.
Code
Public Class Form1
Private Sub GroupBox5_Enter(sender As Object, e As EventArgs) Handles GroupBox5.Enter
End Sub
Private Sub Label11_Click(sender As Object, e As EventArgs) Handles Label11.Click
End Sub
Function CalcOilAndLube() As Decimal
Dim decOil As Decimal
If chkOilChange.Checked = True Then
decOil += 36
End If
If chkLube.Checked = True Then
decOil += 28
End If
Return decOil
End Function
Function Misc() As Decimal
Dim decMisc As Decimal
If chkInspection.Checked = True Then
decMisc += 15
End If
If chkMuffler.Checked = True Then
decMisc += 200
End If
If chkTireRotation.Checked = True Then
decMisc += 20
End If
Return decMisc
End Function
Function RadandTran() As Decimal
Dim decRadcCost As Decimal
If chkRadFlush.Checked = True Then
decRadcCost += 50
End If
If chkTranFlush.Checked = True Then
decRadcCost += 120
End If
Return decRadcCost
End Function
Function Parts() As Decimal
Dim decParts As Decimal
decParts = FormatCurrency(txtParts.Text)
Return decParts
End Function
Function Labor() As Decimal
Dim decLabor As Decimal
decLabor = FormatCurrency(txtLabor.Text)
Return decLabor
End Function
Function Tax() As Decimal
Dim dectax As Decimal
dectax = FormatCurrency(txtParts.Text) * 0.06
Return dectax
End Function
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
ClearMisc()
ClearOil()
ClearOther()
ClearPartsAndLabor()
ClearRad()
End Sub
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim decParts As Decimal
Dim decService As Decimal
Dim decTax As Decimal
Dim decTotal As Decimal
decService = CalcOilAndLube() + Misc() + RadandTran() + Labor()
decParts = Parts()
decTax = Tax()
decTotal = FormatCurrency(decService + decParts + decTax)
lblParts.Text = FormatCurrency(decParts)
lblServicesAndLabor.Text = FormatCurrency(decService)
lblTax.Text = FormatCurrency(decTax)
lblTotal.Text = FormatCurrency(decTotal)
End Sub
Sub ClearOil()
chkOilChange.Checked = False
chkLube.Checked = False
End Sub
Sub ClearRad()
chkRadFlush.Checked = False
chkTranFlush.Checked = False
End Sub
Sub ClearMisc()
chkInspection.Checked = False
chkMuffler.Checked = False
chkTireRotation.Checked = False
End Sub
Sub ClearPartsAndLabor()
txtLabor.Text = String.Empty
txtParts.Text = String.Empty
End Sub
Sub ClearOther()
lblParts.Text = String.Empty
lblServicesAndLabor.Text = String.Empty
lblTax.Text = String.Empty
lblTotal.Text = String.Empty
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Function ValidInputs() As Boolean
Dim decVal1 As Decimal
Dim decVal2 As Decimal
If Not Decimal.TryParse(txtParts.Text, decVal1) Then
MessageBox.Show("Enter a Numeric value please")
Return False
End If
If decVal1 < 0 Then
MessageBox.Show("Number must be positive")
End If
If Not Decimal.TryParse(txtLabor.Text, decVal2) Then
MessageBox.Show("Enter a Numeric value please")
Return False
End If
If decVal2 < 0 Then
MessageBox.Show("Number Must be positive")
End If
Return True
End Function
End Class

![[Image: Syr3DlV.png]](https://i.imgur.com/Syr3DlV.png)
