Solved

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

Posted on 2006-10-20
8
179 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

785 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