Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get the values in a website 2

Status
Not open for further replies.

fcjm

Programmer
Jan 15, 2001
19
0
0
PH
Does anybody have any idea on how can I get a specific data from a website when I am connected to the internet? What I mean is from Visual Basic, I want to get the value of a specific data in a website. Like the value of its text box or list box. I want to use the values in Visual Basic. Does anyone knows how could I do this? Thanks
 
Hi there,
what you need is the Inet control. To add it do the following:

Click on <Project> in the menu and at the bottom <Components>

Find and select the Microsoft Inet Transfer Control

once this is added you will see another component on the components list that looks like a monitor infront of the world.

Put this onto a form, then add a text box named Text1 and a control button.

behind the button you need this code

dim strContents as string
strContents = Form1.Inet1.OpenURL(Form1.Text1.Text)

then if you put a URL into the text box and click the button VB will pull al the content off into the variable. All you need to do is parse the variable for what you need.
:)
'mi casa es su casa'
]-=tty0=-[
ICQ:82621399
 
Thanks for your answer. But, is this the only way? The problem with this is that if the website compose of a lot of html codes, it's really hard to parse it especially when you just need a specific data. Is there any possibility that I can get the value of a textbox or a listbox by calling it's name or id in the html code?
 

You can do that through or with the webbrowser control, but the suggestion by tty0 gets you the html page into a vairable and since you know the name of the control you are looking for it should be simple to use the instr function to get you to the start of the text you want to get to.

Good Luck

 
Thanks for the answers. But is there another way to get the data in a website without using a control? How about using API? Any ideas?
 
I'm beginning to think that you think the API can provide single-line solutions for each of your challenges. Are you anticipating that there might be an API such as:

GetListContentsOfNamedListInURL(ByRef strURL as string, ByRef strListName as string) as String

Because if you are, then you are going to be disappointed. There IS an API solution, but

a) at some point it will closely resemble the INet solution given above (i.e you'll have code that knows how to talk to a website and retrieve a webpage)
b) you'll need to understand both Winsock and HTTP as well as HTML

You also need to be aware that there are numerous ways of implementing listboxes on a webpage, so there's no standard way of identifying one and grabbing its contents
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top