Figured it out myself.
Imports System.IO
Imports System.Net
Imports System.Text
Public Class Form1
Inherits System.Windows. Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents txtPageSource As System.Windows. Forms.TextBox
Friend WithEvents txtURL As System.Windows. Forms.TextBox
Friend WithEvents Label1 As System.Windows. Forms.Label
Friend WithEvents btnGetSource As System.Windows. Forms.Button
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
Me.txtPageSourc e = New System.Windows. Forms.TextBox()
Me.btnGetSource = New System.Windows. Forms.Button()
Me.txtURL = New System.Windows. Forms.TextBox()
Me.Label1 = New System.Windows. Forms.Label()
Me.SuspendLayou t()
'
'txtPageSource
'
Me.txtPageSourc e.Anchor = (((System.Windo ws.Forms.Anchor Styles.Top Or
System.Windows. Forms.AnchorSty les.Bottom) _
Or System.Windows. Forms.AnchorSty les.Left) _
Or System.Windows. Forms.AnchorSty les.Right)
Me.txtPageSourc e.Location = New System.Drawing. Point(8, 32)
Me.txtPageSourc e.Multiline = True
Me.txtPageSourc e.Name = "txtPageSou rce"
Me.txtPageSourc e.ScrollBars = System.Windows. Forms.ScrollBar s.Both
Me.txtPageSourc e.Size = New System.Drawing. Size(672, 272)
Me.txtPageSourc e.TabIndex = 0
Me.txtPageSourc e.Text = ""
'
'btnGetSource
'
Me.btnGetSource .Anchor = (System.Windows .Forms.AnchorSt yles.Bottom Or
System.Windows. Forms.AnchorSty les.Right)
Me.btnGetSource .Location = New System.Drawing. Point(552, 320)
Me.btnGetSource .Name = "btnGetSour ce"
Me.btnGetSource .Size = New System.Drawing. Size(112, 24)
Me.btnGetSource .TabIndex = 1
Me.btnGetSource .Text = "Get Source Code"
'
'txtURL
'
Me.txtURL.Ancho r = ((System.Window s.Forms.AnchorS tyles.Top Or
System.Windows. Forms.AnchorSty les.Left) _
Or System.Windows. Forms.AnchorSty les.Right)
Me.txtURL.Locat ion = New System.Drawing. Point(80, 8)
Me.txtURL.Name = "txtURL"
Me.txtURL.Size = New System.Drawing. Size(600, 20)
Me.txtURL.TabIn dex = 2
Me.txtURL.Text = ""
'
'Label1
'
Me.Label1.Locat ion = New System.Drawing. Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing. Size(48, 23)
Me.Label1.TabIn dex = 3
Me.Label1.Text = "URL"
Me.Label1.TextA lign = System.Drawing. ContentAlignmen t.MiddleRight
'
'Form1
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(704, 366)
Me.Controls.Add Range(New System.Windows. Forms.Control() {Me.Label1,
Me.txtURL, Me.btnGetSource , Me.txtPageSourc e})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout (False)
End Sub
#End Region
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
txtURL.Text = "http://www.jabtech.com "
End Sub
Private Sub btnGetSource_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnGetSource.Cl ick
Dim inputURL, WebPageSourceCo de As String
Dim WebPage As HttpWebRequest
Dim WebPageText As WebResponse
Dim WebPageSource As Stream
Dim WebPageSourceTe xt As StreamReader
On Error GoTo ErrorHandler
txtPageSource.T ext = ""
inputURL = txtURL.Text
WebPage = WebRequest.Crea te(inputURL)
WebPageText = WebPage.GetResp onse()
WebPageSource = WebPageText.Get ResponseStream
WebPageSourceTe xt = New StreamReader(We bPageSource,
System.Text.Enc oding.ASCII)
WebPageSourceCo de = WebPageSourceTe xt.ReadToEnd()
WebPageSourceTe xt.Close()
WebPageSource.C lose()
txtPageSource.T ext = WebPageSourceCo de
Exit Sub
ErrorHandler:
MsgBox("Invalid URL or page not available")
Exit Sub
End Sub
End Class
"John Bradley" <br*****@jabtec h.com> wrote in message
news:09******** *************** *****@phx.gbl.. .
Toooo tired to look this one up.
I have data that I need to acces in a small program. The
data is accessable from an ASP webpage that I created
myself. If I need to see data from record #25, I just
open http://mydomain.com/datapage.asp?recnum=25. I would
like to read this data directly into a variable. I'm sure
this is quite easy (as easy as Fileopen), but I just
can't seem to find it.
Thanks
John