M Getting Errors Saying E Already Declared Parameter Method Line 1 Textbox1 Declared May I Q43887503
I’m getting errors saying:
‘e’ is already declared as a parameter of this method LINE 1
‘textbox1’ is not declared. It may be inaccessible due to itsprotection level LINE 1
‘e’ is already declared as a parameter of this method LINE 49Did I mess something up?
————————————————————————————————————————–
Private Sub btnCalc_Click(sender As Object, e As EventArgs)Handles btnCalc.Click
‘ calculates and displays a bonus amount
Dim decSales As Decimal
Dim decBonus As Decimal
‘ assign input to variables
Decimal.TryParse(txtSales.Text, decSales)
‘ calculate bonus
‘ the bonus is 10% of the sales when the code is
‘ either 1 or 2 and the sales are over 10000
‘ otherwise, the bonus is 5%
If radCode1.Checked = True OrElse
radCode2.Checked = True AndAlso decSales > 10000 Then
decBonus = decSales * 0.1
Else
decBonus = decSales * 0.05
End If
‘ display bonus
lblBonus.Text = decBonus.ToString(“C2”)
End Sub
Private Sub txtSales_KeyPress(sender As Object, e AsKeyPressEventArgs) Handles txtSales.KeyPress
‘ allows the text box to accept only numbers, the period,
‘ and the Backspace key for editing
Try
Dim val As Integer
val = Int32.Parse(textBox1.Text)
If Not (val > 0 AndAlso val < 10) Then
MessageBox.Show(“Invalid input”)
textBox1.Text = “”
End If
Catch e As Exception
MessageBox.Show(“Invalid input”)
textBox1.Text = “”
End Try
If e.KeyChar < “0” OrElse e.KeyChar > “9” AndAlso
e.KeyChar <> “.” AndAlso e.KeyChar <> ControlChars.BackThen
e.Handled = True
End If
End Sub
End Class
Expert Answer
Answer to I’m getting errors saying: ‘e’ is already declared as a parameter of this method LINE 1 ‘textbox1’ is not declared. It …
OR