<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar/2184886057686351170?origin\x3dhttp://astarfall.blogspot.com', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
Timer Control [vb.net]
Tuesday, August 7, 2007


For those who still interested in learning vb.net, ill post a bit bout the control here, some basic ones. =). If you have trouble with it, just nudge me on msn lol.

It seems that everyone is having trouble with the timer control last week so heres a sneak peak on how I did it on Mr. Khairol's last exercise.

Control Names

All the control has default name, timer control cant be displayed since it wasnt suppose to be shown on the form itself, but its there with the name timer1.

So heres the coding


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'what we do here is to set up the ticks to be counted as 1 tick per seconds (the unit used here is miliseconds'
Timer1.Interval = 1000
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'do a check if the label is already zero then the number wont decrease to avoid negative value'
If Label1.Text = 0 Then
Timer1.Enabled = False
Else
'This piece actually makes the number goes down every second ( minus 1 from the label each seconds'
Label1.Text = Label1.Text - 1
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Timer1.Enabled = False
Label1.Text = "30"
End Sub
End Class


Haha tribute to Azimo who scared me when i went online just now. If you guys are wondering who Azimo is, shes my physics tutor ;D

Labels:

♥ 0 voice out ♥

As I wonder.. @ 8:50:00 PM

profile



It would be a lie if i say I'm not nobody, and it would also be exaggerating to say I'm somebody. Cut it short, I'm a student, not that friendly but I try to be. ;), to keep it simple, ask people who know me. They judge me better then I judge myself.

the loves

[x] Friends
[x] Cameras
[x] Graphics
[x] Books
[x] Money (then again who doesnt?)

tagboard


links

credits
designer : kathleen
image : starfall
editor : starfall
helper : lilangel
lyrics : It Ends Tonight/ AAR

A falling star
Least I fall alone.
I can't explain what you can't explain.
You're finding things that you didn't know
I look at you with such disdain

memories
August 2007
September 2007
October 2007
November 2007
December 2007
January 2008