Hello,
I have put together a browser using the AXWebBrowser control. I would like
to access elements of the displayed web page and pass that information back
to the application (say, for example, getting the title (<title>Page
Title</title>) of the page and passing that to a label on the application).
What would be the best method for doing that? Is it even possible?
I may have posted this question before, but I haven't been able to find it
if I have. If so, I am sorry for the repost.
Regards,
Kris 10 1640
Hi Chris,
I used this in an application of mine - place something like the following
code in DocumentComplete of the webbrowser. This assumes that you know what
you want from the web page. I have seen other solutions.
Best wishes
Paul Bromley
Dim HTMLDoc As mshtml.HTMLDocument
Dim elementColl As mshtml.IHTMLElementCollection
Dim element As mshtml.IHTMLElement
Dim sOriginal As String
Dim LinkType As String
Dim StartPosition As Integer
Dim EndPosition As Integer
HTMLDoc = AxWebBrowser1.Document
elementColl = HTMLDoc.all.tags("TBODY")
For Each element In elementColl
sOriginal = element.innerHTML
'ListBox1.Items.Add(sOriginal)
Next element
Dim mName As Match = Regex.Match(sOriginal, "<TD vAlign=top
\?TOP\?><B>Name</B></TD>\s+<TD vAlign=top>.+</TD></TD>",
RegexOptions.IgnoreCase)
Dim iName As Integer
If (mName.Success) Then 'Output match information if a match was found
sName = mName.Value
StartPosition = sName.IndexOf("=top>", 0)
EndPosition = sName.IndexOf("</TD></TD>", 0)
StartPosition = StartPosition + 5
sName = sName.Substring(StartPosition, (EndPosition - StartPosition)) '61 -
Start of Address. 71 = Start of Address +10(Chars to end of text)
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:ee**************@TK2MSFTNGP10.phx.gbl... Hello,
I have put together a browser using the AXWebBrowser control. I would like to access elements of the displayed web page and pass that information
back to the application (say, for example, getting the title (<title>Page Title</title>) of the page and passing that to a label on the
application). What would be the best method for doing that? Is it even possible?
I may have posted this question before, but I haven't been able to find it if I have. If so, I am sorry for the repost.
Regards, Kris
Hi Chris,
I used this in an application of mine - place something like the following
code in DocumentComplete of the webbrowser. This assumes that you know what
you want from the web page. I have seen other solutions.
Best wishes
Paul Bromley
Dim HTMLDoc As mshtml.HTMLDocument
Dim elementColl As mshtml.IHTMLElementCollection
Dim element As mshtml.IHTMLElement
Dim sOriginal As String
Dim LinkType As String
Dim StartPosition As Integer
Dim EndPosition As Integer
HTMLDoc = AxWebBrowser1.Document
elementColl = HTMLDoc.all.tags("TBODY")
For Each element In elementColl
sOriginal = element.innerHTML
'ListBox1.Items.Add(sOriginal)
Next element
Dim mName As Match = Regex.Match(sOriginal, "<TD vAlign=top
\?TOP\?><B>Name</B></TD>\s+<TD vAlign=top>.+</TD></TD>",
RegexOptions.IgnoreCase)
Dim iName As Integer
If (mName.Success) Then 'Output match information if a match was found
sName = mName.Value
StartPosition = sName.IndexOf("=top>", 0)
EndPosition = sName.IndexOf("</TD></TD>", 0)
StartPosition = StartPosition + 5
sName = sName.Substring(StartPosition, (EndPosition - StartPosition)) '61 -
Start of Address. 71 = Start of Address +10(Chars to end of text)
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote in
message news:ee**************@TK2MSFTNGP10.phx.gbl... Hello,
I have put together a browser using the AXWebBrowser control. I would like to access elements of the displayed web page and pass that information
back to the application (say, for example, getting the title (<title>Page Title</title>) of the page and passing that to a label on the
application). What would be the best method for doing that? Is it even possible?
I may have posted this question before, but I haven't been able to find it if I have. If so, I am sorry for the repost.
Regards, Kris
Thanks Paul, this helps a good deal.
Regards,
Kris
"Paul Bromley" <fl*******@dsl.pipex.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl... Hi Chris,
I used this in an application of mine - place something like the following code in DocumentComplete of the webbrowser. This assumes that you know
what you want from the web page. I have seen other solutions.
Best wishes
Paul Bromley
Dim HTMLDoc As mshtml.HTMLDocument Dim elementColl As mshtml.IHTMLElementCollection Dim element As mshtml.IHTMLElement Dim sOriginal As String Dim LinkType As String Dim StartPosition As Integer Dim EndPosition As Integer HTMLDoc = AxWebBrowser1.Document elementColl = HTMLDoc.all.tags("TBODY") For Each element In elementColl sOriginal = element.innerHTML 'ListBox1.Items.Add(sOriginal) Next element Dim mName As Match = Regex.Match(sOriginal, "<TD vAlign=top \?TOP\?><B>Name</B></TD>\s+<TD vAlign=top>.+</TD></TD>", RegexOptions.IgnoreCase) Dim iName As Integer If (mName.Success) Then 'Output match information if a match was found sName = mName.Value StartPosition = sName.IndexOf("=top>", 0) EndPosition = sName.IndexOf("</TD></TD>", 0) StartPosition = StartPosition + 5 sName = sName.Substring(StartPosition, (EndPosition - StartPosition))
'61 - Start of Address. 71 = Start of Address +10(Chars to end of text)
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:ee**************@TK2MSFTNGP10.phx.gbl... Hello,
I have put together a browser using the AXWebBrowser control. I would
like to access elements of the displayed web page and pass that information back to the application (say, for example, getting the title (<title>Page Title</title>) of the page and passing that to a label on the application). What would be the best method for doing that? Is it even possible?
I may have posted this question before, but I haven't been able to find
it if I have. If so, I am sorry for the repost.
Regards, Kris
Thanks Paul, this helps a good deal.
Regards,
Kris
"Paul Bromley" <fl*******@dsl.pipex.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl... Hi Chris,
I used this in an application of mine - place something like the following code in DocumentComplete of the webbrowser. This assumes that you know
what you want from the web page. I have seen other solutions.
Best wishes
Paul Bromley
Dim HTMLDoc As mshtml.HTMLDocument Dim elementColl As mshtml.IHTMLElementCollection Dim element As mshtml.IHTMLElement Dim sOriginal As String Dim LinkType As String Dim StartPosition As Integer Dim EndPosition As Integer HTMLDoc = AxWebBrowser1.Document elementColl = HTMLDoc.all.tags("TBODY") For Each element In elementColl sOriginal = element.innerHTML 'ListBox1.Items.Add(sOriginal) Next element Dim mName As Match = Regex.Match(sOriginal, "<TD vAlign=top \?TOP\?><B>Name</B></TD>\s+<TD vAlign=top>.+</TD></TD>", RegexOptions.IgnoreCase) Dim iName As Integer If (mName.Success) Then 'Output match information if a match was found sName = mName.Value StartPosition = sName.IndexOf("=top>", 0) EndPosition = sName.IndexOf("</TD></TD>", 0) StartPosition = StartPosition + 5 sName = sName.Substring(StartPosition, (EndPosition - StartPosition))
'61 - Start of Address. 71 = Start of Address +10(Chars to end of text)
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:ee**************@TK2MSFTNGP10.phx.gbl... Hello,
I have put together a browser using the AXWebBrowser control. I would
like to access elements of the displayed web page and pass that information back to the application (say, for example, getting the title (<title>Page Title</title>) of the page and passing that to a label on the application). What would be the best method for doing that? Is it even possible?
I may have posted this question before, but I haven't been able to find
it if I have. If so, I am sorry for the repost.
Regards, Kris
Paul,
I have noted that, in my application, using this code results in the
mshtml.HTMLDocument (and other such references) as being "undeclared". Is
there a particular reference I have to add?
Regards,
Kris
"Paul Bromley" <fl*******@dsl.pipex.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl... Hi Chris,
I used this in an application of mine - place something like the following code in DocumentComplete of the webbrowser. This assumes that you know
what you want from the web page. I have seen other solutions.
Best wishes
Paul Bromley
Dim HTMLDoc As mshtml.HTMLDocument Dim elementColl As mshtml.IHTMLElementCollection Dim element As mshtml.IHTMLElement Dim sOriginal As String Dim LinkType As String Dim StartPosition As Integer Dim EndPosition As Integer HTMLDoc = AxWebBrowser1.Document elementColl = HTMLDoc.all.tags("TBODY") For Each element In elementColl sOriginal = element.innerHTML 'ListBox1.Items.Add(sOriginal) Next element Dim mName As Match = Regex.Match(sOriginal, "<TD vAlign=top \?TOP\?><B>Name</B></TD>\s+<TD vAlign=top>.+</TD></TD>", RegexOptions.IgnoreCase) Dim iName As Integer If (mName.Success) Then 'Output match information if a match was found sName = mName.Value StartPosition = sName.IndexOf("=top>", 0) EndPosition = sName.IndexOf("</TD></TD>", 0) StartPosition = StartPosition + 5 sName = sName.Substring(StartPosition, (EndPosition - StartPosition))
'61 - Start of Address. 71 = Start of Address +10(Chars to end of text)
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:ee**************@TK2MSFTNGP10.phx.gbl... Hello,
I have put together a browser using the AXWebBrowser control. I would
like to access elements of the displayed web page and pass that information back to the application (say, for example, getting the title (<title>Page Title</title>) of the page and passing that to a label on the application). What would be the best method for doing that? Is it even possible?
I may have posted this question before, but I haven't been able to find
it if I have. If so, I am sorry for the repost.
Regards, Kris
Paul,
I have noted that, in my application, using this code results in the
mshtml.HTMLDocument (and other such references) as being "undeclared". Is
there a particular reference I have to add?
Regards,
Kris
"Paul Bromley" <fl*******@dsl.pipex.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl... Hi Chris,
I used this in an application of mine - place something like the following code in DocumentComplete of the webbrowser. This assumes that you know
what you want from the web page. I have seen other solutions.
Best wishes
Paul Bromley
Dim HTMLDoc As mshtml.HTMLDocument Dim elementColl As mshtml.IHTMLElementCollection Dim element As mshtml.IHTMLElement Dim sOriginal As String Dim LinkType As String Dim StartPosition As Integer Dim EndPosition As Integer HTMLDoc = AxWebBrowser1.Document elementColl = HTMLDoc.all.tags("TBODY") For Each element In elementColl sOriginal = element.innerHTML 'ListBox1.Items.Add(sOriginal) Next element Dim mName As Match = Regex.Match(sOriginal, "<TD vAlign=top \?TOP\?><B>Name</B></TD>\s+<TD vAlign=top>.+</TD></TD>", RegexOptions.IgnoreCase) Dim iName As Integer If (mName.Success) Then 'Output match information if a match was found sName = mName.Value StartPosition = sName.IndexOf("=top>", 0) EndPosition = sName.IndexOf("</TD></TD>", 0) StartPosition = StartPosition + 5 sName = sName.Substring(StartPosition, (EndPosition - StartPosition))
'61 - Start of Address. 71 = Start of Address +10(Chars to end of text)
"Kris Rockwell" <kr***************************@hybrid-learning.com> wrote
in message news:ee**************@TK2MSFTNGP10.phx.gbl... Hello,
I have put together a browser using the AXWebBrowser control. I would
like to access elements of the displayed web page and pass that information back to the application (say, for example, getting the title (<title>Page Title</title>) of the page and passing that to a label on the application). What would be the best method for doing that? Is it even possible?
I may have posted this question before, but I haven't been able to find
it if I have. If so, I am sorry for the repost.
Regards, Kris
Hi Kris,
For the mshtml. you have to set a reference to mshtm in the normal reference
project=>Add.reference->.Net->Microsoft.mshtml
Notice that Paul uses only the tag innerHTML and than start using the regex.
However you can almost get every part from the document because it uses the
Document Object Model DOM.
I hope this helps?
Cor
Hi Kris,
For the mshtml. you have to set a reference to mshtm in the normal reference
project=>Add.reference->.Net->Microsoft.mshtml
Notice that Paul uses only the tag innerHTML and than start using the regex.
However you can almost get every part from the document because it uses the
Document Object Model DOM.
I hope this helps?
Cor
Thanks for the pointer Cor. This will most likely clear things up.
Regards,
Kris
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ee**************@TK2MSFTNGP11.phx.gbl... Hi Kris,
For the mshtml. you have to set a reference to mshtm in the normal
reference project=>Add.reference->.Net->Microsoft.mshtml
Notice that Paul uses only the tag innerHTML and than start using the
regex. However you can almost get every part from the document because it uses
the Document Object Model DOM.
I hope this helps?
Cor
Thanks for the pointer Cor. This will most likely clear things up.
Regards,
Kris
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ee**************@TK2MSFTNGP11.phx.gbl... Hi Kris,
For the mshtml. you have to set a reference to mshtm in the normal
reference project=>Add.reference->.Net->Microsoft.mshtml
Notice that Paul uses only the tag innerHTML and than start using the
regex. However you can almost get every part from the document because it uses
the Document Object Model DOM.
I hope this helps?
Cor
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Larry Tate |
last post by:
I am wanting to get those cool html error pages that ms produces when I hit
an error in asp.net. For instance, when I get a compilation error I get an
html error page that shows me the
...
|
by: Gunjan Garg |
last post by:
Hello All,
I am working to create a generic datagrid which accepts a
datasource(ListData - This is our own datatype) and depending on the calling
program customizes itself for sorting,...
|
by: cnys |
last post by:
We have an ASP.NET 2.0 (C#) app and we're trying to add tracing into it.
The tracing functionality within .NET is great, but when we output this to a
file, it's kind of sparse.
So, we're looking...
|
by: rustyc |
last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-)
As I said over there:
... for a little side project at home, I'm writing a ham radio web site in...
|
by: buntyindia |
last post by:
Hi,
I have a very strange problem with my application.
I have developed it using Struts.
I have a TextBox With Some fixed value in it and on Submit iam passing it to another page.
<html:form...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |