Error 3 'Cal' is not declared. It may be inaccessible due to its protection level. C:\Users\Owner\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 9 9 WindowsApplication1
Error 1 'gallon' is already declared as 'Friend WithEvents gallon As System.Windows.Forms.Label' in this class. C:\Users\Owner\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 2 9 WindowsApplication1
Error 2 'total' is already declared as 'Friend WithEvents total As System.Windows.Forms.Label' in this class. C:\Users\Owner\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 3 9 WindowsApplication1
Error 6 Statement is not valid in a namespace. C:\Users\Owner\AppData\Local\Temporary Projects\WindowsApplication1\Form1.vb 22 1 WindowsApplication1
I do not understand what I am doing wrong. Help is appreciated
Public Class Form1
Dim gallon As Double ' total gallons
Dim total As Decimal ' total price gallons times grade price
Dim regular As Decimal = 2.69
Dim special As Decimal = 2.79
Dim super As Decimal = 2.89
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Cal(Val(TextBox1.Text), Val(TextBox2.Text), 0)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Cal(Val(TextBox1.Text), Val(TextBox2.Text), 1)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Cal(Val(TextBox1.Text), Val(TextBox2.Text), 2)
End Sub
End Class
Private Sub Cal(ByVal num1 As Integer, ByVal num2 As Integer, ByVal ops As Integer)
Select Case ops
Case 0
textbox2.Text = gallons * regular
Case 1
textbox2.Text = gallons * special
Case 2
textbox2.Text = gallons * super
End Select
End Sub
End Class

New Topic/Question
Reply



MultiQuote





|