0

コンパイル時にフォームにこのエラー メッセージが表示されます。フォームは機能し、希望どおりに動作しますが、エラーが表示され続けます。

ここに私のソースコードがあります:

Option Strict On
Option Explicit On

Public Class frmEnterMidPoint

    Dim Obj As New frmCustomRanges

    Private Sub txtMidPointValue_TextChanged(sender As Object, e As EventArgs) Handles txtMidPointValue.TextChanged

        'This event runs when the txtMidPointValue is changed.
        'it enables the clear button if it's not empty.

        If txtMidPointValue.Text = "" Then

            btnClear.Enabled = False

        Else

            btnClear.Enabled = True

        End If


    End Sub

    Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click


        'This event runs when the btnOk is pressed. The procedure takes the value
        'entered in the text box and converts to a decimal.  That value
        'is then sent to the frmCustomRanges form Mid label. The procedure
        'also calculates the hourly equivalent.  

        'The procedure ends by closing the current form and opening
        'the frmCustomRanges form.

        If IsNumeric(txtMidPointValue.Text) Then

            'Convert number entered to decimal
            Dim decMidPointValue As Decimal = Convert.ToDecimal(txtMidPointValue.Text)

            'Display results as dollar sign for Annual and Hourly
            Obj.lblAnnualMid.Text = decMidPointValue.ToString("C")
            Obj.lblHourlyMid.Text = Convert.ToDecimal(decMidPointValue / 52 / 40).ToString("C")

            'Close current form
            Me.Close()

            'Open frmCustomRanges
            Obj.ShowDialog()

        Else

            MsgBox("You have entered a non-numeric value. Please check value and enter again", vbCritical, "Input Error")


            With txtMidPointValue
                .Text = ""
                .Focus()

            End With

        End If

    End Sub

    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

        'This event runs when the btnClear is clicked.
        'The event clears the textbox and sends the foucs
        'back to the textbox

        With txtMidPointValue
            .Text = ""
            .Focus()

        End With

    End Sub

    Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click

        'This even runs when the btnCancel is clicked.
        'The procedure closes the current form and opens the
        'Custom Ranges form.


        'Close current form
        Me.Close()

        'Open the Custom Ranges form
        Obj.ShowDialog()


    End Sub

End Class
4

2 に答える 2