finn0013
Aug 14th, 2006, 09:27 AM
I am new to C# and am having trouble translating the following line from VB.net to C#:
Public Sub BeforeNavigate2(ByVal pDisp As Object, ByRef URL As String, ByRef flags As Object, ByRef targetFrameName As String, ByRef postData As Object, ByRef headers As String, ByRef cancel As Boolean) Implements DWebBrowserEvents2.BeforeNavigate2
' Do stuff...
End Sub
What I have so far is:
public void BeforeNavigate2(Object pDisp, String URL, Object flags, String targetFrameName, Object postData, String headers) { // Do stuff... }
But when compiling, I get the following error:
Error 1 'ModifiableWebBrowser.WebBrowserExtendedEvents' does not implement interface member 'ModifiableWebBrowser.DWebBrowserEvents2.BeforeNavigate2(object, string, object, string, object, string)'. 'ModifiableWebBrowser.WebBrowserExtendedEvents.BeforeNavigate2(object, string, object, string, object, string)' is either static, not public, or has the wrong return type. C:\Documents and Settings\jmcdonald\My Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\ModifiableWebBrowser.cs 81 18 WindowsApplication3
I know that I need to tell the app that this method is implementing the DWebBrowserEvents2.BeforeNavigate2 method, but can not figure out the syntax. I have searched for the syntax for this but must be searching by the wrong criteria as I have not found anything yet. Help?
Public Sub BeforeNavigate2(ByVal pDisp As Object, ByRef URL As String, ByRef flags As Object, ByRef targetFrameName As String, ByRef postData As Object, ByRef headers As String, ByRef cancel As Boolean) Implements DWebBrowserEvents2.BeforeNavigate2
' Do stuff...
End Sub
What I have so far is:
public void BeforeNavigate2(Object pDisp, String URL, Object flags, String targetFrameName, Object postData, String headers) { // Do stuff... }
But when compiling, I get the following error:
Error 1 'ModifiableWebBrowser.WebBrowserExtendedEvents' does not implement interface member 'ModifiableWebBrowser.DWebBrowserEvents2.BeforeNavigate2(object, string, object, string, object, string)'. 'ModifiableWebBrowser.WebBrowserExtendedEvents.BeforeNavigate2(object, string, object, string, object, string)' is either static, not public, or has the wrong return type. C:\Documents and Settings\jmcdonald\My Documents\Visual Studio 2005\Projects\WindowsApplication3\WindowsApplication3\ModifiableWebBrowser.cs 81 18 WindowsApplication3
I know that I need to tell the app that this method is implementing the DWebBrowserEvents2.BeforeNavigate2 method, but can not figure out the syntax. I have searched for the syntax for this but must be searching by the wrong criteria as I have not found anything yet. Help?