Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 its protection level LINE 1

'e' is already declared as a parameter of this method LINE 49 Did 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 As KeyPressEventArgs) 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.Back Then e.Handled = True End If 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_2

Step: 3

blur-text-image_3

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

Database Programming Languages 12th International Symposium Dbpl 2009 Lyon France August 2009 Proceedings Lncs 5708

Authors: Philippa Gardner ,Floris Geerts

2009th Edition

3642037925, 978-3642037924

More Books

Students also viewed these Databases questions

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago