Help with option Strict

C

Cor

Hi Option Strict gurus,
Because of the so much given advises here to use Option Strict I did try to
use that.
But it gives an error and I don't know how to resolve that.
The message is that Option Strict disallowes late binding. So how to do it
then?
The statement is from an example somewhere on MSDN
(And don't ask why I use the Ax version from SHDOC, that is just because it
has more methods)
\\\\\\\\\\\\\
Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As System.Object,
ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles
AxWebBrowser1.DocumentComplete
eDocuments.Add(e.pDisp.Document)
End Sub
/////////////
Cor
 
H

Herfried K. Wagner [MVP]

Hello,

Cor said:
Because of the so much given advises here to use Option
Strict I did try to use that.
But it gives an error and I don't know how to resolve that.
The message is that Option Strict disallowes late binding.
So how to do it then?
The statement is from an example somewhere on MSDN
(And don't ask why I use the Ax version from SHDOC,
that is just because it has more methods)
\\\\\\\\\\\\\
Private Sub AxWebBrowser1_DocumentComplete(ByVal sender As System.Object,
ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles
AxWebBrowser1.DocumentComplete
eDocuments.Add(e.pDisp.Document)
End Sub

How is eDocuments defined? Where exactly do you get the error?

Regards,
Herfried K. Wagner
 
C

Cor

Hi,
Thanks all, it did bring me on the route for this nice sunday puzzle.
It is not the eDocuments that gives the error, sorry that I did not say
that(That is a collection, but after all the post I have seen I will change
it in an arraylist).
It is the e.pdisp.Document (that is as far as I can see from the type
mshtml.htmldocument)
If you know the answer please let me know, otherwise I give my results in
the evening OK?
Cor
 
C

Cor

Charles,
Thanks no gives the same problem.
I think I will look if I can avoid the axwebbrowser which was I thougt in
2002 and removed in 2003,
the pdisp has the object system._ComObject.
I maybe start to understand why.
Don't spend any time anymore on it, it was just my curiosity.
Cor
 
H

Herfried K. Wagner [MVP]

Hello,

Cor said:
Thanks no gives the same problem.
I think I will look if I can avoid the axwebbrowser which was I thougt in
2002 and removed in 2003,
the pdisp has the object system._ComObject.
I maybe start to understand why.
Don't spend any time anymore on it, it was just my curiosity.

That's one of the rare cases where I would turn 'Option Strict' off. I hope
they will introduce Option-blocks in a future release:

\\\
Option Strict On
..
..
..
Option Strict Off
 
T

Tom Spink

In theory, you can have a pseudo-option block, by putting the code into a
module, in a different file, putting Option Strict Off at the top of the
file, and just calling the method that the code is within. Then you don't
need to turn off Option Strict globally, or even for the code-file you are
working with.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Maybe it's a game called 'Punish the User'"
 
H

Herfried K. Wagner [MVP]

Hello,

Cor said:
I am glad you wrote that, thanks
(Do you think Armin will read this)

I didn't see him in the ngs today. Maybe he is on holidays now.

;-)

Regards,
Herfried K. Wagner
 
C

Cor

Charles,
I try it,
It is weekend, I have to make dinner now, now said my wife.
I message you later.
Thanks even if it does not work.
Cor
 
C

Cor

Charles,
I had dinner and I told often to Herfried what that means, but
My new gallary of Honnor is "Bill Gates, Herfried, Jay B, Charles"
Tomorrow I go examine what you did
Thanks
 
C

Cor

Charles,
I think I start to understand now what happens, and am not only copying that
part.
This is to what I did bring it back.
Dim wb As SHDocVw.WebBrowser = DirectCast(e.pDisp, SHDocVw.WebBrowser)
eDocuments.Add(wb.Document)
Thanks again of course.
Cor
 
T

Tom Spink

Got a few chins there, Armin.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Maybe it's a game called 'Punish the User'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top