View Full Version : Need help sorting out text that I want.

02-14-2011, 11:22 PM
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 ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:Button ID="Button1" runat="server" Text="Get Source Code" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

and here's my vb code that does everything:

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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum