Hello everyone, i wanted to ask you all how to make a count down timer with only one timer (seconds) but including the hours and minutes(i.e. You can write the hours mins and secs you want (input) it to wait then make it count down with the secs timers) im sure i have to use if statements (If Label14.Text = "00" And Label15.Text = "00" And Label16.Text = "00" Then) something like that but im not sure.
thanks.
EDIT: Also could you tell me how to convert a String to an Integer. Ive tried Convert.ToInt32(textbox1.text) but didnt work
Count down timer [VB .NET]
Forum rules
- Ask questions about or share code from languages other than Source Engine scripting.
- Start new topic titles with the code language in brackets (i.e. [C#], [C++], [PHP], etc.)
- Ask questions about or share code from languages other than Source Engine scripting.
- Start new topic titles with the code language in brackets (i.e. [C#], [C++], [PHP], etc.)
-
- Former Server Admin
- Posts: 292
- Joined: Mon Aug 23, 2010 8:41 pm
Count down timer [VB .NET]
Hi, I'm Reloaded. :)
Code: Select all
[GR|CMX] Reelawded | Reloaded : hi, im black
[GR|CMX] Reelawded | Reloaded : shit
Disconnect: being black.
Disconnect: being black.
-
- Site Admin
- Posts: 668
- Joined: Fri Apr 09, 2010 4:09 pm
Re: Count down timer [VB .NET]
Hmm try this out. I don't know if this will work as I use visual basic 6 at school.
Val(Whatever.text)
Val = Value.
Val(Whatever.text)
Val = Value.
-
- Former Server Admin
- Posts: 292
- Joined: Mon Aug 23, 2010 8:41 pm
Re: Count down timer [VB .NET]
thanks nick, that works too. But i used this:nick_6893 wrote:Hmm try this out. I don't know if this will work as I use visual basic 6 at school.
Val(Whatever.text)
Val = Value.
Code: Select all
Try
sec = TextBox3.Text
Label16.Text = sec.ToString
Catch ex As Exception
Label16.Text = "0"
TextBox3.Text = "0"
TextBox3.SelectAll()
End Try
Hi, I'm Reloaded. :)
Code: Select all
[GR|CMX] Reelawded | Reloaded : hi, im black
[GR|CMX] Reelawded | Reloaded : shit
Disconnect: being black.
Disconnect: being black.
-
- 500+ Posts
- Posts: 588
- Joined: Mon Jul 05, 2010 8:51 pm
- Location: Ontario, Canada
Re: Count down timer [VB .NET]
killman2639 wrote:Hello everyone, i wanted to ask you all how to make a count down timer with only one timer (seconds) but including the hours and minutes(i.e. You can write the hours mins and secs you want (input) it to wait then make it count down with the secs timers) im sure i have to use if statements (If Label14.Text = "00" And Label15.Text = "00" And Label16.Text = "00" Then) something like that but im not sure.
thanks.
EDIT: Also could you tell me how to convert a String to an Integer. Ive tried Convert.ToInt32(textbox1.text) but didnt work
Code: Select all
Convert.ToInt32(TextBox1.Text.ToString())
Unkown wrote: Life’s too short to worry about the little things.
Albert Einstein wrote: You do not really understand something unless you can explain it to your grandmother.
-
- Former Server Admin
- Posts: 292
- Joined: Mon Aug 23, 2010 8:41 pm
Re: Count down timer [VB .NET]
Thanks smacked, ill edit the program right away.Smacked wrote:By the way for the count down I would make a new thread and use multi-threading to you'r advantage or use a background workerCode: Select all
Convert.ToInt32(TextBox1.Text.ToString())
EDIT: i know ull call me new but i tried this and it doesnt send any errors but it does not do the thing inside the if()
Code: Select all
Convert.ToInt32(TextBox3.Text.ToString())
If TextBox3.Text > 24 Then
Label16.Text = "0"
TextBox3.Text = "0"
TextBox3.SelectAll()
End If
Whole SUB:
Code: Select all
Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged
Try
Convert.ToInt32(TextBox3.Text.ToString())
If TextBox3.Text > 24 Then
Label16.Text = "0"
TextBox3.Text = "0"
TextBox3.SelectAll()
End If
sec = TextBox3.Text
Label16.Text = sec.ToString
Catch ex As Exception
Label16.Text = "0"
TextBox3.Text = "0"
TextBox3.SelectAll()
End Try
End Sub
Hi, I'm Reloaded. :)
Code: Select all
[GR|CMX] Reelawded | Reloaded : hi, im black
[GR|CMX] Reelawded | Reloaded : shit
Disconnect: being black.
Disconnect: being black.
-
- 500+ Posts
- Posts: 588
- Joined: Mon Jul 05, 2010 8:51 pm
- Location: Ontario, Canada
Re: Count down timer [VB .NET]
DOOOOOOOOOOOOOOOOOOOODEEEEEEEEEEE
you create an integer and then have that new integer = the converted form of that text box or have that convert thing were the text box is in the if statement.
works the same way as Replace() for text ie.
by the way what are you trying to make a elapsed time or what ever or a clock?
cuz like i wouldn't use that many text boxes for a clock or timer... or elapsed time
as well it sounds like a GABEN program
you create an integer and then have that new integer = the converted form of that text box or have that convert thing were the text box is in the if statement.
works the same way as Replace() for text ie.
Code: Select all
Dim Blah As String = "Im such a negro"
Blah = Replace(Blah, "negro", "wigger")
'Replaces negro to wigger
cuz like i wouldn't use that many text boxes for a clock or timer... or elapsed time
as well it sounds like a GABEN program
Unkown wrote: Life’s too short to worry about the little things.
Albert Einstein wrote: You do not really understand something unless you can explain it to your grandmother.
-
- Former Server Admin
- Posts: 292
- Joined: Mon Aug 23, 2010 8:41 pm
Re: Count down timer [VB .NET]
thanks again : p. the program is ready i just have to make an english translation and we all set. Thanks to everyone that helpedSmacked wrote:DOOOOOOOOOOOOOOOOOOOODEEEEEEEEEEE
you create an integer and then have that new integer = the converted form of that text box or have that convert thing were the text box is in the if statement.
works the same way as Replace() for text ie.by the way what are you trying to make a elapsed time or what ever or a clock?Code: Select all
Dim Blah As String = "Im such a negro" Blah = Replace(Blah, "negro", "wigger") 'Replaces negro to wigger
cuz like i wouldn't use that many text boxes for a clock or timer... or elapsed time
as well it sounds like a GABEN program
Hi, I'm Reloaded. :)
Code: Select all
[GR|CMX] Reelawded | Reloaded : hi, im black
[GR|CMX] Reelawded | Reloaded : shit
Disconnect: being black.
Disconnect: being black.