Question

I have built a simple InteropForms class using the project template in VS 2010. It builds successfully and registers the library in the system. I can see it and reference it in VB6 but none of the public methods or properties I add to the class in VS2010 are visible.

What am I doing wrong?

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
Was it helpful?

Solution

The template comes from the toolkit: VB6 InteropForm Library

It's not supported in VS2012 (yet...)... Toolkit for VS2012

I figured it out. You have to add an InteropFormMethod attribute to the method in question and then rebuild the wrapper.

    ''' <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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top