Значение типа 'Boolean' нельзя преобразовать в 'Microsoft.Vbe.Interop.Forms.ReturnBoolean' - PullRequest
0 голосов
/ 10 марта 2012

Прежде всего, позвольте мне предоставить вам мой код:

Private Sub txtLatMin_Exit(ByVal Cancel As ReturnBoolean)
    Dim i_SelStart As Long
    Dim str_Prompt As String


    'Save the cursor position.
    i_SelStart = txtLatMin.SelectionStart

    'Remove characters that we can't use.
    txtLatMin.Text = NumericPortion(txtLatMin.Text, True)

    'Enforce the maximums:
    If Val(txtLatMin.Text) + Val(txtLatSec.Text) / 60 >= 60 Then
        str_Prompt = "The maximum number of latitude minutes is 59.999."
        MsgBox(str_Prompt, vbExclamation, "Notification")
        Cancel = True
    ElseIf Val(Me.textbox_Latitude_Degrees.Text) + Val(txtLatMin.Text) / 60 + Val(txtLatSec.Text) / 3600 > 89.99 Then
        str_Prompt = "The maximum number of latitude degrees is 89.99."
        MsgBox(str_Prompt, vbExclamation, "Notification")
        Cancel = True
    End If

    'Restore the cursor position.
    txtLatMin.SelectionStart = i_SelStart
End Sub

В этом сообщении отмечается ошибка в Отмена = Истина

Помните, что я конвертирую код из VB6 в VB.NET

Будут ли какие-либо предложения, которые кто-нибудь может мне дать?

1 Ответ

2 голосов
/ 10 марта 2012

Я считаю, что вам нужно изменить

Cancel = True

до

Cancel.Value = True
...