Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-14-2011, 11:22 PM   PM User | #1
tightendutah
New Coder

 
Join Date: Feb 2011
Posts: 18
Thanks: 6
Thanked 0 Times in 0 Posts
tightendutah is an unknown quantity at this point
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:

Code:
<%@ 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>
and here's my vb code that does everything:
Code:
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
tightendutah is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:09 PM.


Advertisement
Log in to turn off these ads.