[VB.NET] Making a Countdown

  • Hello Guest! Welcome to ConsoleCrunch, to help support our site check out the premium upgrades HERE! to get exclusive access to our hidden content.
  • Unable to load portions of the website...
    If you use an ad blocker addon, you should disable it because it interferes with several elements of the site and blocks more than just adverts.
  • Read Rules Before Posting Post Virus Scans with every program.

1UP

Member
Oct 9, 2014
24
10
63
Well this was something is something from a program I wrote years back. Basically the user would put in a number and the program would then convert it to seconds and then begin the count down.

So to get this started, either drag a timer control over to your form or create one through code(not going to be going over this one)

Let's take what the use put in the textbox and convert it to seconds
(This program was based on hours)

Code:
 Private Sub btn_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_start.Click
  Dim time As String

time = txt_time.Text * 3600
txt_time.Text = time
timer1.enabled =true
 End Sub
I coded things wierd years ago, so you could pretty much do this a better way, but I'm just coping and pasting what I had.




In the timer_tick proceedure we are going to do this:

Code:
 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
   
  txt_time.Text = myTime - 1
  myTime = txt_time.Text
  If txt_time.Text= 0 Then
  'Insert event here
  Next
  End If
  End Sub
 
  • Like
Reactions: Elite_Modz
Well this was something is something from a program I wrote years back. Basically the user would put in a number and the program would then convert it to seconds and then begin the count down.

So to get this started, either drag a timer control over to your form or create one through code(not going to be going over this one)

Let's take what the use put in the textbox and convert it to seconds
(This program was based on hours)

Code:
Private Sub btn_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_start.Click
  Dim time As String

time = txt_time.Text * 3600
txt_time.Text = time
timer1.enabled =true
End Sub
I coded things wierd years ago, so you could pretty much do this a better way, but I'm just coping and pasting what I had.




In the timer_tick proceedure we are going to do this:

Code:
 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  
  txt_time.Text = myTime - 1
  myTime = txt_time.Text
  If txt_time.Text= 0 Then
  'Insert event here
  Next
  End If
  End Sub
Damn keep up the good work.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • @ ANGUS0023233:
    Been awhile
  • @ QM|T_JinX:
    sup bro
  • @ ANGUS0023233:
    Do you got BF6 jinx?
  • @ QM|T_JinX:
    no i dont
  • @ QM|T_JinX:
    kept Diein to that f%cking game haha
  • @ QM|T_JinX:
    not sure if i type that correct haha i died alot on that game in beta
  • @ ANGUS0023233:
    Ah you tried playing the Battlefield 6 alpha labs beta. I only played the Alpha Beta then Open beta then the game itself since i enjoyed it all lot
  • @ QM|T_JinX:
    it a good lookin game for sure but im not as good anymore in that game haha
    so it seems hahah
  • @ lurch6661:
    high
  • @ QM|T_JinX:
    high
  • @ QM|T_JinX:
    bro im not on messager ok if im online on there ppl start to message me dont feel like going on and on on text
  • @ lurch6661:
    ok bro
  • @ QM|T_JinX:
    nothing agains you you know that right just dont feel like answer all those text the hole time
  • @ lurch6661:
    i understand trust m e lol
  • @ QM|T_JinX:
    by the way i unlocked the gold camo on bo7 looks pretty cool hahah
  • @ lurch6661:
    lol
  • @ ANGUS0023233:
    Jinx do you got PSN ?
  • @ QM|T_JinX:
    yea i do
  • @ QM|T_JinX:
    my gf is coming over i check you guys later on tc guys
  • @ lurch6661:
    ok bro tc
  • @ ANGUS0023233:
    Wow bunch of my links and such are gone i’ll have to look into it and try to fix it or update it anyways take care lurch and jinx
  • @ QM|T_JinX:
    t bro good to see you back on here catch you guys later
  • Chat Bot:
    QM|T_JinX has joined the room.
  • Chat Bot:
    Christo has joined the room.
      Chat Bot: Christo has joined the room.