我使用VS 2010中的项目模板构建了一个简单的InteropForms类。它成功构建并在系统中注册库。我可以在VB6中看到它并引用它,但是我在VS2010中添加到类中的公共方法或属性都不可见。
我做错了什么?
Imports Microsoft.InteropFormTools
<InteropForm()> _
Public Class frmWebBrowserPreview
Private Sub frmWebBrowserPreview_KeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp
If e.KeyCode = Windows.Forms.Keys.Escape Then Hide()
End Sub
Private Sub frmWebBrowserPreview_MouseUp(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
Hide()
End Sub
Private Sub wbrPreview_DocumentCompleted(sender As Object, e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wbrPreview.DocumentCompleted
wbrPreview.Visible = True
End Sub
''' <summary>
''' Navigate to the specified URL
''' </summary>
''' <param name="strURL">The URL string</param>
Public Function Navigate(strURL As String) As Boolean
wbrPreview.Navigate(strURL)
End Function
End Class
答案 0 :(得分:0)
模板来自工具包:VB6 InteropForm Library
VS2012不支持(还......)...... Toolkit for VS2012
我明白了。您必须向相关方法添加InteropFormMethod属性,然后重建包装器。
''' <summary>
''' Navigate to the specified URL
''' </summary>
''' <param name="strURL">The URL string</param>
<InteropFormMethod()> _
Public Function Navigate(strURL As String) As Boolean
wbrPreview.Navigate(strURL)
End Function