Solved

Project help for class.................

Posted on 2006-10-20
8
178 Views
Last Modified: 2010-04-23
I am trying to create a program in vb.net to take data, ie tempratures in farhenheit, and then convert it to celsius. I have it working to convert but having dificulties to get it to connect to the website in the background and gather the temperature data for the conversion. It works fine when we enter the degrees in farenheit manually tho. We would like to enter a zip code and have it gather the temerature data in farenheit and display it in the field we've created that performs the conversion. This project is due soon and I have exhasted all the sources I know of.                                                                                                                                  Any suggestions or ideas will be welcome!!!!!
0
Comment
Question by:MorphinDragon
8 Comments
 
LVL 13

Expert Comment

by:newyuppie
ID: 17778221
how do you plan to pull the data from the web? or is that the question?
0
 

Author Comment

by:MorphinDragon
ID: 17778258
thats the question my friend
0
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 500 total points
ID: 17778671
To connect to the website, I'd use the AxWebBrowser control to load the page, then strip the temperatures from the Document property's HTML body.  You can also use the Document property to get the the form controls.  Something like this:

'Add the following references to your project first:  [COM] Microsoft Internet Controls, [.NET] Microsoft.mshtml

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AxWebBrowser1.Navigate("http://www.YourTemperaturePage.com")
    End Sub

    Private Sub AxWebBrowser1_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles AxWebBrowser1.NavigateComplete2
        Dim doc As mshtml.HTMLDocument = AxWebBrowser1.Document
        Dim body As mshtml.IHTMLElement = doc.body

        '"body" now has the HTML code of the page's body, so you can pull the data from it.
    End Sub
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:Mohamed Zedan
ID: 17780965
or maybe the website offers rss feeds that you could consume and get your data from as extracting data from XML is much more easier and light weight than loading the cumbersome MSHTML.dll library.
0
 

Author Comment

by:MorphinDragon
ID: 17782291
I will try these suggestions and let u know what comes about.
0
 
LVL 14

Expert Comment

by:ptakja
ID: 17782384
You could also check to see if the web site offers a Web Service that you could subscribe to. If it does, you most likely would  be able to call a function in their service that returns a temps for a given zip or city.
0
 

Author Comment

by:MorphinDragon
ID: 17824147
Ok guys, got the program to search a zip code and put the source code onto a txt file (auto saves to the computer). Now we need it to search the txt file for "temp=" and then the, up to, 3 digits after it and then display that in the program itself. Still brainstorming it but could use a few ideas. We actually found another post in here that was similar and used part of the code that was in the comments. I hope all that makes sense. Ideas more than welcome!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now