Menu
support@authoritypapers.com
+1(805) 568 7317

hello i am taking a visual basic class and for an hw assignment we have to make an a 5188220

hello, i am taking a visual basic class and for an hw assignment we have to make an application that opens a main form in which in turn opens a second or third form depending on selection. That part i did but in the assignment we had addition things to do. The additional instructions were…

“Prevent entering anything but numbers in all the text boxes of this assignment by coding the

KeyDown event and suppressing they key. For example you could use a select case statement

as shown below

Select Case e.KeyCode

Case Keys.NumPad0 To Keys.NumPad9

'do nothing

Case Else

Beep()

e.SuppressKeyPress = True

End Select

The above handles the numeric keypad you would still have to code the numbers on the

keyboard Keys.D0 To Keys.D9.”

im not sure i understand what is being asked of me. i understand what he wants if its not a number but i dont understand the key down part. This is what i have for one of the additional forms, i always have a math madule if it goes there.

Option Strict On
Public Class MetersToEnglish

    Private Sub ConvertInchesButton_Click(sender As Object, e As EventArgs) Handles ConvertInchesButton.Click

        Dim Meters As Double     ' To hold the meters
        Dim Inches As Double     ' To hold the inches

        Try
            ((e.KeyCode >= Keys.D0) And (e.KeyCode
            Select Case e.KeyCode
                Case Keys.NumPad0 To Keys.NumPad9
'do nothing
                Case Keys.D0 To Keys.D9
                    'do nothing
                Case Else
                    Beep()
                    e.SuppressKeyPress = True
            End Select

            ' Get the meters.
            Meters = CDbl(MetersText.Text)

            ' Convert meters to inches.
            Inches = MetersToInches(Meters)
            ' Display the result.
            AnswerLabel.Text = (Meters.ToString() & ” meters equals ” &
                            Inches.ToString() & ” inches.”)
        Catch
            ' Display an error message for invalid input.
            MessageBox.Show(“Error: Enter a numeric value.”)
        End Try
    End Sub

    Private Sub CovertFeetButton_Click(sender As Object, e As EventArgs) Handles CovertFeetButton.Click

        Dim Meters As Double   ' To hold the meters
        Dim Feet As Double     ' To hold the feet

        Try
            ' Get the meters.
            Meters = CDbl(MetersText.Text)

            ' Convert meters to feet.
            Feet = MetersToFeet(Meters)

            ' Display the result.
            AnswerLabel.Text = (Meters.ToString() & ” meters equals ” &
                            Feet.ToString() & ” feet.”)
        Catch
            ' Display an error message for invalid input.
            MessageBox.Show(“Error: Enter a numeric value.”)
        End Try
    End Sub

    Private Sub ConvertYardsButton_Click(sender As Object, e As EventArgs) Handles ConvertYardsButton.Click

        Dim Meters As Double     ' To hold the meters
        Dim Yards As Double      ' To hold the yards

        Try
            ' Get the meters.
            Meters = CDbl(MetersText.Text)

            ' Convert meters to yards.
            Yards = MetersToYards(Meters)

            ' Display the result.
            AnswerLabel.Text = (Meters.ToString() & ” meters equals ” &
                            Yards.ToString() & ” yards.”)
        Catch
            ' Display an error message for invalid input.
            MessageBox.Show(“Error: Enter a numeric value.”)
        End Try
    End Sub

    Private Sub CloseButton_Click(sender As Object, e As EventArgs) Handles CloseButton.Click

        ' Close the form.
        Me.Close()
    End Sub

End Class

Thank you so much!

-Alexander Martinez

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now