473,480 Members | 2268 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Storing links in string array using WebBrowser Control

I have a WinForm application that has a WebBrowser Control.

I can navigate to any website fine.

I want to store the link addresses in an array to be called back later.

For example, if I visit a news website's main page (www.newswebsite.com),
they will have links to other stories. The links' address usually appears in
the status bar when you mouse over the link (say for example,
www.newswebsite.com/story1).

How do I "get" these links off of a webpage?

Now that I think about it, I'll need to know how many links are on the page
to run the loop that creates the array.

Any ideas?

John
Nov 21 '05 #1
5 2079

"Kruegy Man" <Kr*******@discussions.microsoft.com> wrote
I have a WinForm application that has a WebBrowser Control.
You will very likely get more informed responses if you
post your question to a group where they discuss .NET.

A few you might pick from include:

news://msnews.microsoft.com/microsof...dotnet.general
news://msnews.microsoft.com/microsof...t.languages.vb
news://msnews.microsoft.com/microsof....vsnet.general
news://msnews.microsoft.com/microsof...studio.general
news://msnews.microsoft.com/microsof....vstudio.setup

How do I "get" these links off of a webpage?


The brwoser shows documents, and has a Document property.
You can learn what that document contains through that property.

Check out the anchors collection of the Document object:
http://msdn.microsoft.com/library/de...j_document.asp

HTH
LFS
Nov 21 '05 #2

"Kruegy Man" <Kr*******@discussions.microsoft.com> wrote
I have a WinForm application that has a WebBrowser Control.


Sorry for that previous post! I thought I was viewing a different group!

Nonetheless, the anchors collection of the Document object will help
you find all the links:

http://msdn.microsoft.com/library/de...j_document.asp
(oops)
LFS

Nov 21 '05 #3
Kruegy,

You need for that mshtml, it is a hard way to go and that part will be
improved in the 2005 version

http://msdn.microsoft.com/library/de...ng/hosting.asp

You have to set a reference to it, however never an import because your IDE
will freeze than because of the amount of interfaces in it.

I hope this helps?

Cor

"Kruegy Man"
I have a WinForm application that has a WebBrowser Control.

I can navigate to any website fine.

I want to store the link addresses in an array to be called back later.

For example, if I visit a news website's main page (www.newswebsite.com),
they will have links to other stories. The links' address usually appears
in
the status bar when you mouse over the link (say for example,
www.newswebsite.com/story1).

How do I "get" these links off of a webpage?

Now that I think about it, I'll need to know how many links are on the
page
to run the loop that creates the array.

Any ideas?

John

Nov 21 '05 #4
Larry / Cor,

Thank you for your replies. They got me pointed in the right direction.

This is my first time jumping into Web stuff. I'm used to just standard
Win32 Apps.

Thanks again,

John

"Cor Ligthert" wrote:
Kruegy,

You need for that mshtml, it is a hard way to go and that part will be
improved in the 2005 version

http://msdn.microsoft.com/library/de...ng/hosting.asp

You have to set a reference to it, however never an import because your IDE
will freeze than because of the amount of interfaces in it.

I hope this helps?

Cor

"Kruegy Man"
I have a WinForm application that has a WebBrowser Control.

I can navigate to any website fine.

I want to store the link addresses in an array to be called back later.

For example, if I visit a news website's main page (www.newswebsite.com),
they will have links to other stories. The links' address usually appears
in
the status bar when you mouse over the link (say for example,
www.newswebsite.com/story1).

How do I "get" these links off of a webpage?

Now that I think about it, I'll need to know how many links are on the
page
to run the loop that creates the array.

Any ideas?

John


Nov 21 '05 #5

"Larry Serflaten" <se*******@usinternet.com> wrote
"Kruegy Man" <Kr*******@discussions.microsoft.com> wrote
I have a WinForm application that has a WebBrowser Control.
Nonetheless, the anchors collection of the Document object will help
you find all the links:

http://msdn.microsoft.com/library/de...j_document.asp


My bad, I should have gone there and looked closer....

Its the Links collection that has the links....

HTH
LFS
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11729
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
6
3569
by: Tiraman | last post by:
Hi, i have some html string and i would like to display it like the web browser does. what is the best way to do it ? Best Regards , Tiraman :-)
0
1028
by: Robert | last post by:
How can I simulate a click on an anchor element from a links-collection in the WebBrowser control? I'm using VS 2005 and the WebBrowser control in .NET 2.0. Do you have any suggestions? Thanks...
5
3055
by: Jesper | last post by:
Hi, Is there an alternative to an URI location when loading html into a webBrowser control. I have some html generated in a string. I would like to skip saving the string to a file on disk...
4
6037
by: adwooley2 | last post by:
Can't seem to find anything that works for me. I have a small bit of HTML that is stored in a string variable. I want to assign this string to an mshtml object (IHTMLDocument2 I believe), so that...
4
3207
by: Dennis | last post by:
Is there any way I can display an html string in a windows form or windows form control like a rich text box. Note, I'm using windows forms, not the web. Thanks for any help. -- Dennis in...
4
11979
by: Steve Richter | last post by:
I would like to build an HTML stream as a string and have the WebBrowser control render that HTML. Then on PostBack, or whatever it is called, I would like my code to be the one that receives what...
4
1354
thav
by: thav | last post by:
I initialized an array, ArrayName name = arrayName ; with 100 elements. In the program its taking string data and putting them into the array. by using Console.Writeline, it asks the user...
6
13699
by: Leon | last post by:
Hi there, I am trying to use the WebBrowser Control in a form which is being started in an own thread by the main form of my application. Unfortunately I am always getting an error in...
0
7051
marktang
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,...
0
6915
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7054
Oralloy
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,...
0
7097
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6993
tracyyun
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...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.