|
-
Dec 10th, 2002, 04:40 AM
#1
Thread Starter
Sleep mode
calling dll
guys ,Could anyone hlep me to get out of this hell ?
I am calling a dll method which is "Navigate" and "Navigate2" from my class "Navigation" but it keeps firing this error which damn says :
an unhandled exception of type "InvalidActiveXStateException" occurred in axinterop.shdocvw.dll
when I call this method from the form it's fine.
Don't you think this have to do with inheritence :
I tried this :
VB Code:
Imports AxSHDocVw.AxWebBrowser
Public Class Navigation
Public Shared MyWeb As New AxSHDocVw.AxWebBrowser()
Public Shared Function Back() As String
MyWeb.GoBack()
End Function
Public Shared Function Forward() As String
MyWeb.GoForward()
End Function
Public Shared Function Go() As String
End Function
Public Shared Function Refresh() As String
MyWeb.Refresh()
End Function
Public Shared Function Stopp() As String
MyWeb.Stop()
End Function
Public Shared Function Home() As String
MyWeb.GoHome()
End Function
Public Shared Function Navigate() As String
Dim nullObject As System.Object = 0
Dim URL As Object
Dim Str As String = ""
Dim nullObjStr As System.Object = Str
Cursor.Current = Cursors.WaitCursor ' Navigate to location found in textbox
MyWeb.Navigate2(URL, nullObject, nullObjStr, nullObjStr, nullObjStr)
Cursor.Current = Cursors.Default
'or you can safely use this :
'MyWeb.Navigate("www.home.com")
End Function
End Class
-
Dec 10th, 2002, 04:43 AM
#2
Thread Starter
Sleep mode
the error occurred only in this code:
VB Code:
Public Shared Function Navigate() As String
Dim nullObject As System.Object = 0
Dim URL As Object
Dim Str As String = ""
Dim nullObjStr As System.Object = Str
Cursor.Current = Cursors.WaitCursor ' Navigate to location found in textbox
'here ++++++++++++++++++++++++++++++++++++++
MyWeb.Navigate2(URL, nullObject, nullObjStr, nullObjStr,
nullObjStr)
'++++++++++++++++++++++++++++++++++++++++++
Cursor.Current = Cursors.Default
'or you can safely use this :
'here ++++++++++++++++++++++++++++++
'MyWeb.Navigate("www.home.com")
End Function
-
Dec 10th, 2002, 05:39 AM
#3
Don't really know a lot about this, but here are some thoughts:
MSDN has this to say:
"The public properties and methods of an ActiveX control can only be referenced after the ActiveX control has been instantiated and initialized completely; otherwise the AxHost.InvalidActiveXStateException exception is thrown. The AxHost.InvalidActiveXStateException exception class contains the name of the member that made the reference and the member type. The member type is one of the AxHost.ActiveXInvokeKind enumerated values."
Is Navigate2() a function? Does it return an error/success value? Can you look at that to get some extra information?
Can you look at the members of AxHost.InvalidActiveXStateException and find out exactly what exception is being thrown? Maybe you can put a Try - Catch around the call to Navigate2 and ignore the error and see what result that gives you (just for debug - i'm not recommending you release your code like that!)
This world is not my home. I'm just passing through.
-
Dec 10th, 2002, 06:10 AM
#4
Thread Starter
Sleep mode
you're great man
First , it doesn't return value.
Second , when I set the try _ catch structure a msg thrown says :
"exception of type invalidActiveXStateException was thrown"
I did created the instance but dunno how to initialize it .It needs that constructor to be supplied with parameters .
thanx a lot trisuglow for your time.
-
Dec 10th, 2002, 10:54 PM
#5
Thread Starter
Sleep mode
If I got one more push , I'll appreciate that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|