|
|
#1 |
|
Solid State Member
Join Date: Oct 2011
Posts: 17
|
Good readings everyone.... i want to make a countdown timer in vb.net. this is what i got
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick dim x as integer = textbox1.text dim y as integer = 60 dim ans as integer = x * y label1.text = ans - 1 end sub if i input one in the textbox and run the program it only change the text in the label box as 59, its like its counting down but only once. how could i do it! please help me! |
|
|
|
|
|
#2 |
|
Site Team
|
what is the x * y supposed to do?
Not sure how it works in VB, but there should be a way to do something like the following: private sub textbox1.textChanged integer x = 60 (or whatever your limit is) label1.txt = x - textbox1.size
__________________
"as a fanboy i refuse to admit it and will pull countless things out of my butt to disprove it" Team Thelegorm! Total Kills: 21 (i iz in uor profile, editsing your sigz) |
|
|
|
|
|
#3 |
|
Site Team
Join Date: Mar 2004
Posts: 6,945
|
Umm,
you get the value of X at the start of each time the timer ticks. the text box value appears to be set at 1. get value from text box (=1), times 60, (=60) minus 1 (=59) write result to label. then it starts again. you need to either read the label, or change the value in the text box. Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick dim x as integer = textbox1.text dim y as integer = 60 dim ans as integer = x * y textbox1.text = ans - 1 end sub
__________________
I didn’t fight my way to the top of the food chain to be a vegetarian… Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns. "The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries." |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|