By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,286 Members | 2,443 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,286 IT Pros & Developers. It's quick & easy.

Interesting IntelliSense behaviour with Webbrowser

P: n/a
Hi there,
I needed to use MouseOver event on Webbrowser which is NOT provided by
webbrowser control natively(what a disappointment), so i decided to go
with another route to simulate this like:
////////////////////////////////////////////////
Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As
System.Windows.Forms.HtmlElementEventArgs)

' My codes here

End Sub

Private Sub webbrowser1_DocumentCompleted(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) Handles
webbrowser1.DocumentCompleted

' Here is my question
' Although intellisense doesn't recognize "Document", but i'm still
able to compile
' and use this addhandler syntax without any build or runtime errors
AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks

End Sub
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

...that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?

I hope i have explained enoug clear,
Thanks,

Onur Gzel
Jul 7 '08 #1
Share this Question
Share on Google+
11 Replies


P: n/a

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:2f**********************************@m44g2000 hsc.googlegroups.com...
Hi there,
I needed to use MouseOver event on Webbrowser which is NOT provided by
webbrowser control natively(what a disappointment), so i decided to go
with another route to simulate this like:
////////////////////////////////////////////////
Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As
System.Windows.Forms.HtmlElementEventArgs)

' My codes here

End Sub

Private Sub webbrowser1_DocumentCompleted(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) Handles
webbrowser1.DocumentCompleted

' Here is my question
' Although intellisense doesn't recognize "Document", but i'm still
able to compile
' and use this addhandler syntax without any build or runtime errors
AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks

End Sub
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

....that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?

I hope i have explained enoug clear,
Thanks,

Onur Gzel

What are you trying to get. If you are trying to get a link when the mouse
is over one on a page you can use the StatusTextChanged event to get links.

LS

Jul 7 '08 #2

P: n/a
kimiraikkonen wrote:
Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

...that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?
It does on my machine. Me.WebBrowser1.Document comes right up. Something else
not compiling correctly?
Jul 8 '08 #3

P: n/a
>
What are you trying to get. If you are trying to get a link when the mouse
is over one on a page you can use the StatusTextChanged event to get links.

LS
Yes, but that doesn't provide when mouse is over an image which is my
goal about retrieving image location.

However, i did it using "AddHandler webbrowser1.Document.MouseOver,
AddressOf Me.DisplayHyperlinks" but my question and wonder was just
about why Intellisense doesn't offer "Document" after webbrowser1
while you're typing syntax manually instead of pasting from
somewhere,you can test it. Though IntelliSense doesn't offer and
recognize "Document" after "webbrowser1" object, if i type it without
addhandler keyword just to use its members somewhere else it sees
"Document" member of "webbrowser1" object with no problem, but as i
said if paste the code without manually typing, there are no errors
reported even on building my application.

That's weird of IntelliSense.

Thanks,

Onur
Jul 8 '08 #4

P: n/a
kimiraikkonen wrote:
somewhere,you can test it. Though IntelliSense doesn't offer and
recognize "Document" after "webbrowser1" object, if i type it without
addhandler keyword just to use its members somewhere else it sees
"Document" member of "webbrowser1" object with no problem,
Ah, you mean it doesn't show Document after AddHandler.

No, it wouldn't. It will filter the list of WebBrowser members to show events
that can have a handler added.

You can get intellisense for the list of Document events by declaring a temp
variable first:
Dim x As HtmlDocument = WebBrowser1.Document
AddHandler x.MouseOver, AddressOf Me.DisplayHyperlinks
Jul 8 '08 #5

P: n/a
Hi Steve,
Yes, if i use this syntax, intellisense recognizes every object with no
problem.
Dim x As HtmlDocument = WebBrowser1.Document
AddHandler x.MouseOver, AddressOf Me.DisplayHyperlinks
But if i use in this way, it doesn't show "Document" property just after
"Webbrowser1"(it's impatient that it expects an event), though that code is
compiled and it works as it should:

AddHandler kimibrowser.Document.MouseOver, AddressOf Me.DisplayHyperlinks

Thanks for the care,

Onur Güzel
--
Best regards,

Onur Güzel
ki*************@hotmail.com
"Steve Gerrard" wrote:
kimiraikkonen wrote:
Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

...that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?

It does on my machine. Me.WebBrowser1.Document comes right up. Something else
not compiling correctly?
Jul 8 '08 #6

P: n/a
Yeah, a straight code like:

Me.Webbrowser1.Document... has also no recognition problem by Intellisense
on my machine,too.

The problem with Intellisense was the syntax i was using:
AddHandler webbrowser1.Document.MouseOver, AddressOf Me.DisplayHyperlinks
Thanks,

Onur Güzel

--
Best regards,

Onur Güzel
ki*************@hotmail.com
"Steve Gerrard" wrote:
kimiraikkonen wrote:
Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

...that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?

It does on my machine. Me.WebBrowser1.Document comes right up. Something else
not compiling correctly?
Jul 8 '08 #7

P: n/a

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:2f**********************************@m44g2000 hsc.googlegroups.com...
Hi there,
I needed to use MouseOver event on Webbrowser which is NOT provided by
webbrowser control natively(what a disappointment), so i decided to go
with another route to simulate this like:
////////////////////////////////////////////////
Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As
System.Windows.Forms.HtmlElementEventArgs)

' My codes here

End Sub

Private Sub webbrowser1_DocumentCompleted(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) Handles
webbrowser1.DocumentCompleted

' Here is my question
' Although intellisense doesn't recognize "Document", but i'm still
able to compile
' and use this addhandler syntax without any build or runtime errors
AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks

End Sub
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

....that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?

I hope i have explained enoug clear,
Thanks,

Onur Gzel

Finally got a chance to test this and I do not see the problem you describe.

The app I used to test is one that takes a list of URL's and in a tabcontrol
, creates a new tabpage, a new WebBrowser, and then adds the WebBrowser to
the tabpage and the tabpage to the tabcontrol.

My code is (for the webbrowser) is just

Dim wc As New WebBrowser

Now when I type

AddHandler wc. (now I get document) . and I get a list of not just events
but properties and functions as well.

I can select MouseOver from the list and all is good.

I am using VS 2008 Pro.

LS

Jul 8 '08 #8

P: n/a
Hi Lloyd,
I'm using VB 2005 express and i placed Webbrowser control from toolbox into
my form, and it doesn't recognize Document property if i use it in a
"Addhandler" syntax.

Addhandler webbrowser.<i don't get Document, it expects an event as
well>.MouseOver,AddressOf Me.DisplayHyperlinks

As you're using VS 2008, maybe that may have been fixed in 2008 or you need
to place Webbrowser control to your form instead of manually creating
WebBrowser instance.

And of course when i use Webbrowser1 object elsewhere like in a sub or in a
button1.click event there's no problem with intellisense

Webbrowser1.Document.members...... (no problem)

The problem was recognizing Document property of Webbrowser within Addhandler.

Plus, Steve's suggestion worked to make Webbrowser recognize all the objects:
Dim x As HtmlDocument = WebBrowser1.Document
AddHandler x.MouseOver, AddressOf Me.DisplayHyperlinks

Thanks,

Onur
--
Best regards,

Onur Güzel
ki*************@hotmail.com
"Lloyd Sheen" wrote:
>
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:2f**********************************@m44g2000 hsc.googlegroups.com...
Hi there,
I needed to use MouseOver event on Webbrowser which is NOT provided by
webbrowser control natively(what a disappointment), so i decided to go
with another route to simulate this like:
////////////////////////////////////////////////
Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As
System.Windows.Forms.HtmlElementEventArgs)

' My codes here

End Sub

Private Sub webbrowser1_DocumentCompleted(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) Handles
webbrowser1.DocumentCompleted

' Here is my question
' Although intellisense doesn't recognize "Document", but i'm still
able to compile
' and use this addhandler syntax without any build or runtime errors
AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks

End Sub
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

....that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?

I hope i have explained enoug clear,
Thanks,

Onur Güzel

Finally got a chance to test this and I do not see the problem you describe.

The app I used to test is one that takes a list of URL's and in a tabcontrol
, creates a new tabpage, a new WebBrowser, and then adds the WebBrowser to
the tabpage and the tabpage to the tabcontrol.

My code is (for the webbrowser) is just

Dim wc As New WebBrowser

Now when I type

AddHandler wc. (now I get document) . and I get a list of not just events
but properties and functions as well.

I can select MouseOver from the list and all is good.

I am using VS 2008 Pro.

LS

Jul 8 '08 #9

P: n/a

"kimiraikkonen" <ki***********@discussions.microsoft.comwrote in message
news:4B**********************************@microsof t.com...
Hi Lloyd,
I'm using VB 2005 express and i placed Webbrowser control from toolbox
into
my form, and it doesn't recognize Document property if i use it in a
"Addhandler" syntax.

Addhandler webbrowser.<i don't get Document, it expects an event as
well>.MouseOver,AddressOf Me.DisplayHyperlinks

As you're using VS 2008, maybe that may have been fixed in 2008 or you
need
to place Webbrowser control to your form instead of manually creating
WebBrowser instance.

And of course when i use Webbrowser1 object elsewhere like in a sub or in
a
button1.click event there's no problem with intellisense

Webbrowser1.Document.members...... (no problem)

The problem was recognizing Document property of Webbrowser within
Addhandler.

Plus, Steve's suggestion worked to make Webbrowser recognize all the
objects:
Dim x As HtmlDocument = WebBrowser1.Document
AddHandler x.MouseOver, AddressOf Me.DisplayHyperlinks

Thanks,

Onur
--
Best regards,

Onur Güzel
ki*************@hotmail.com
"Lloyd Sheen" wrote:
>>
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:2f**********************************@m44g200 0hsc.googlegroups.com...
Hi there,
I needed to use MouseOver event on Webbrowser which is NOT provided by
webbrowser control natively(what a disappointment), so i decided to go
with another route to simulate this like:
////////////////////////////////////////////////
Public Sub DisplayHyperlinks(ByVal sender As Object, ByVal e As
System.Windows.Forms.HtmlElementEventArgs)

' My codes here

End Sub

Private Sub webbrowser1_DocumentCompleted(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.WebBrowserDocumentCompletedE ventArgs) Handles
webbrowser1.DocumentCompleted

' Here is my question
' Although intellisense doesn't recognize "Document", but i'm still
able to compile
' and use this addhandler syntax without any build or runtime errors
AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks

End Sub
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Shortly:
"AddHandler webbrowser1.Document.MouseOver, AddressOf
Me.DisplayHyperlinks"

....that syntax claims no error when it's built / compiled, but
IntelliSense doesn't recognize "Document" after "webbrowser1" object.

Why?

I hope i have explained enoug clear,
Thanks,

Onur Güzel

Finally got a chance to test this and I do not see the problem you
describe.

The app I used to test is one that takes a list of URL's and in a
tabcontrol
, creates a new tabpage, a new WebBrowser, and then adds the WebBrowser
to
the tabpage and the tabpage to the tabcontrol.

My code is (for the webbrowser) is just

Dim wc As New WebBrowser

Now when I type

AddHandler wc. (now I get document) . and I get a list of not just
events
but properties and functions as well.

I can select MouseOver from the list and all is good.

I am using VS 2008 Pro.

LS

I changed my project for a test by adding a webbrowser to the form. I can
still use the addHandler to get the intellisense that is correct and
includes MouseOver. Again I am using VS 2008 so I don't know if that is the
difference.

I don't have any extra references or anything out of the ordinary.

LS

Jul 9 '08 #10

P: n/a
kimiraikkonen wrote:
>What are you trying to get. If you are trying to get a link when the mouse
is over one on a page you can use the StatusTextChanged event to get links.

LS

Yes, but that doesn't provide when mouse is over an image which is my
goal about retrieving image location.

However, i did it using "AddHandler webbrowser1.Document.MouseOver,
AddressOf Me.DisplayHyperlinks" but my question and wonder was just
about why Intellisense doesn't offer "Document" after webbrowser1
while you're typing syntax manually instead of pasting from
somewhere,you can test it. Though IntelliSense doesn't offer and
recognize "Document" after "webbrowser1" object, if i type it without
addhandler keyword just to use its members somewhere else it sees
"Document" member of "webbrowser1" object with no problem, but as i
said if paste the code without manually typing, there are no errors
reported even on building my application.

That's weird of IntelliSense.

Thanks,

Onur
Could it be that your reference link to the MSHTML library is corrupted?
** Posted from http://www.teranews.com **
Jul 9 '08 #11

P: n/a
On Jul 8, 4:16 pm, "Mr. Clean" <mrclean@p&G.comwrote:
kimiraikkonen wrote:
What are you trying to get. If you are trying to get a link when the mouse
is over one on a page you can use the StatusTextChanged event to get links.
LS
Yes, but that doesn't provide when mouse is over an image which is my
goal about retrieving image location.
However, i did it using "AddHandler webbrowser1.Document.MouseOver,
AddressOf Me.DisplayHyperlinks" but my question and wonder was just
about why Intellisense doesn't offer "Document" after webbrowser1
while you're typing syntax manually instead of pasting from
somewhere,you can test it. Though IntelliSense doesn't offer and
recognize "Document" after "webbrowser1" object, if i type it without
addhandler keyword just to use its members somewhere else it sees
"Document" member of "webbrowser1" object with no problem, but as i
said if paste the code without manually typing, there are no errors
reported even on building my application.
That's weird of IntelliSense.
Thanks,
Onur

Could it be that your reference link to the MSHTML library is corrupted?
** Posted fromhttp://www.teranews.com**
It doesn't seem any reference to MSHTML library, i use Webbrowser
control.

However, as i stated, pasting the whole code claims no error even on
compiling about "Document" when it's used with Addhandler, and just
IntelliSense doesn't recognize Document after Addhandler
webbrowser.Document...., except Steve's workaround that is described
in previous posts which is worked.

Thanks,

Onur Gzel
Jul 9 '08 #12

This discussion thread is closed

Replies have been disabled for this discussion.