Get weather from a site

xion911

Member
Joined
Aug 26, 2011
Messages
8
Programming Experience
Beginner
Can somebody help me load some if this weather info into textboxes? Burbank, California (91501) Conditions & Forecast : Weather Underground

BTW I have no idea what I'm doing. Anything you can give me to help me get started would be great.

Perhaps start with how to load this weather into text boxes:


<div class="dataCol1">Ozone</div>
<div class="dataCol2"><span class="b">Good</span></div>
<div class="dataCol3"><div class="aqIndex aq1"></div></div> <div class="dataCol1">PM2.5</div> <div class="dataCol2"><span class="b">Moderate</span></div> <div class="dataCol3"><div class="aqIndex aq2"></div></div>

Ozone should read "Good" and PM2.5 should read "Moderate"
 

ProtekNickz

Well-known member
Joined
Oct 22, 2009
Messages
130
Location
UK
Programming Experience
1-3
im thinking you want to load the weather into a Windows form Labels or Textbox?, if so then you would need to either parse the page or use the

TextBox1.text = WebBrowser1.Document.GetElementById("Element Name Here").GetAttribute("Attribute as string here")

hope this helps :)
 

xion911

Member
Joined
Aug 26, 2011
Messages
8
Programming Experience
Beginner
Thanks for the tip. I am having a hard time finding the element ID. I have watched some tutorials and the html code they have has "id" somewhere in it. All mine has is, well, you can see.
 

ProtekNickz

Well-known member
Joined
Oct 22, 2009
Messages
130
Location
UK
Programming Experience
1-3
Hi i'm sorry for the first post its part right, just the ending was wrong :D, here's the correct way to do this
TextBox1.Text = WebView.Document.GetElementById("tempActual").InnerText
To Find the Elements of the page you need, what i did was view the page source then look for "Weather at a Glance" which was the table Title for the main weather then all bellow that was the Element ID's bellow look carefully and you'll se then all :), this should do what i think you need :)
 

xion911

Member
Joined
Aug 26, 2011
Messages
8
Programming Experience
Beginner
So there's an ID called "conds_details_health" and that gives a lot of info. Do you know how I can break it up into sever text boxes? This is what I get
"Health
UV7 out of 16Pollen6.00 out of 12
Pollen Forecast OzoneGoodPM2.5ModerateFlu ActivitySporadic
View Flu Map "
 

ProtekNickz

Well-known member
Joined
Oct 22, 2009
Messages
130
Location
UK
Programming Experience
1-3
View Page Source then CTRL + F to fins string, then put in "Weather at a Glance" and bellow that is mostly all the element ID's you need
 

Latest posts

Top Bottom