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

相关问题