2012-03-10 3 views
0

まずオフに変換することはできません、私は私のコードを提供してみましょう:値が「Microsoft.Vbe.Interop.Forms.ReturnBoolean」

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 

それは、この記事でエラーフラグを立てるれますのタイトルは

私は誰かを私に提供することができると何か提案があるだろうVB.NET

にVB6からコードを変換していますのでご注意ください= Trueのキャンセル?

+0

Cancel = True 

を変更する必要があると考えています。マイグレーションアシスタントは、変更されないコードにのみ役立ちます。それをさらに開発する必要があるとすぐに、最初から始めて正しく実行する方が良いでしょう。なぜなら、移行したコードはいつも恐ろしい混乱になるからです。あなたはそのコードを維持したくはありません。 –

答えて

2

私はあなたが捨てて完全にコードを書き換えることを検討し

Cancel.Value = True 
+0

これは完璧です。本当にありがとう。 –