2012-03-10 54 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 

它標記錯誤在這個崗位標題取消=真

請記住,我從VB6代碼轉換到VB.NET

會不會有什麼建議的人可以爲我提供?

+0

考慮扔掉,並徹底重寫代碼。遷移助手僅適用於不會更改的代碼。只要您需要進一步開發它,從頭開始並正確執行它會更好,因爲您遷移的代碼總是會變得非常糟糕。你*不*要保持該代碼。 – 2012-03-10 19:55:52

回答

2

我認爲,你需要改變

Cancel = True 

Cancel.Value = True 
+0

這是完美的。謝謝一堆。 – 2012-03-10 18:37:23

相關問題