Page 1 of 1

VB.NET Weather Viewer

Posted: Thu Jan 21, 2010 6:48 pm
by rocky4126
ok so I have a new v2 app (v2 meening tested and released in my own language). All it does is uses a picturebox and gets the latest image from sat24.com. So here's the tutorial, and you may notice I do everything in steps it's more fun that way :lol:.

Ok so here we go
Part I - Setup
ok add the following:
  • form1
    picturebox1
    timer1
Part II - Coding
ok so now add this to the code for form 1
Code: Select all
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start() 'This starts the timer so that the picture can change.
        Me.AutoSize = True 'This makes it so that form1(Me) changes its size to suit the contents
        If My.Computer.Network.IsAvailable = False Then 'this checks to see if the network is available, if it is disabled then this will show
            MsgBox("Please check your network connection or contact your adminsistrator. If used in a school then your network may be down or disabled. in this case please contact your technicians or tell your teacher.", MsgBoxStyle.OkOnly, "Network: OFFLINE") 'This creates a one-time instance (messagebox or msgbox) then displays text as a string etc.
        End If 'this ends the if function above.
    End Sub
add this to the code for timer1 or just keep on that page!
Code: Select all
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        PictureBox1.ImageLocation = "http://www.sat24.com/image.ashx?country=eu&type=slide&index=1&sat" 'this gets the picture from a site, in our case sat24.com. If you want feel free to change it!
        If My.Computer.Network.IsAvailable = True Then 'this is same as the other one we did but instead it checks to see if there IS a connection to establish
            Me.Text = "real-time weather updater 15 min updater - " & Date.UtcNow & " Weather is online " & "data supplied by: www.sat24.com" 'if it is a true network then this will show on the top of the form
        Else 'if the above is not true then it will try this vv
            Me.Text = "real-time weather updater 15 min updater - " & Date.UtcNow & " Warning: Weather offline!" 'changes the title to this
        End If
    End Sub
[hr]
Updates are now coming to: www.rocky4126.myfastforum.org. All updates posted by users:
Operator
egg1321
rocky4126

Re: VB.NET Weather Viewer

Posted: Sat Feb 13, 2010 1:12 pm
by hungryhounduk
Hi Rocky
This looks really cool
well done cooll;

i might recreate this and have it as an addon to my Dictionary Program :)

Chris

Re: VB.NET Weather Viewer

Posted: Sat Feb 13, 2010 8:55 pm
by rocky4126
no probs hungry, Thanks for the comment and, to CnS, Thanks for clearing up all the unnecercarry posts.