[VB.NET 2010]Random External IP Viewer

12/09/2011 17:36 summoner01#1
Just a random app I made to test httpwebrequest. May be useful to some who wish to get their External IP address on the fly without having to open up a browser and do a search for a website, then copy the ip etc.

VT Info:

Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.whatismyip.org/")
        Dim response As System.Net.HttpWebResponse = request.GetResponse

        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
        Dim regsource As String = sr.ReadToEnd

        TextBox1.Text = regsource
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Clipboard.SetText(TextBox1.Text)
    End Sub
End Class
12/09/2011 20:55 .KeRo#2
it loads to long,
before the form starts.. :D
but it works..
(i knowed this before :) )
12/09/2011 21:28 summoner01#3
Ah yea, I noticed that too that sometimes when it opens nothing happens, so I just open it again. Maybe some kind of delay or check to make sure the form loads first, then have it do the request. It was just a simple app though, as long as it does what is intended, I think it's fine xD Glad ya like it.