Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
02-14-2011, 11:22 PM #1
- Join Date
- Feb 2011
- Thanked 0 Times in 0 Posts
Need help sorting out text that I want.
So What I'm trying to do is get the temperature from this site in degrees celsius:
http://weather.noaa.gov/weather/current/KDPG.html. I wrote a code to get the source code from the site, I just don't know how to choose the data that I want. All it does now is put the source code of the site in the text box I want my info to be in. Here's my code for the button I click to start the vb code, probably irrelevant:
<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <asp:Button ID="Button1" runat="server" Text="Get Source Code" /> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </asp:Content>
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://weather.noaa.gov/weather/current/KDPG.html") Dim response As System.Net.HttpWebResponse = request.GetResponse() Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream()) Dim sourcecode As String = sr.ReadToEnd() TextBox1.Text = sourcecode End Sub End Class