Outline ·
[ Standard ] ·
Linear+
vb.net timer, Timer functions
|
TSWalaweiii
|
Apr 10 2019, 04:31 PM, updated 7y ago
|
New Member
|
need some help im using vs 2019 and i know the default count for timer in vs is 1000 miliseconds which is 1 seconds.
how do i change the code if let say: i take input from user in seconds, and i change it to ms. where do i replace the miliseconds value?
i mean..the timer has no code right?
|
|
|
|
|
|
KanGz
|
Apr 10 2019, 04:37 PM
|
Getting Started

|
timer.Interval = 1000;
|
|
|
|
|
|
cytyler
|
Apr 10 2019, 04:37 PM
|
|
timer has no default count just convert s to ms (x1000) eg. Timer1.Interval = 1000; //ms
|
|
|
|
|
|
hoilok
|
Apr 10 2019, 04:37 PM
|
|
update the timer property
|
|
|
|
|
|
TSWalaweiii
|
Apr 10 2019, 04:44 PM
|
New Member
|
QUOTE(KanGz @ Apr 10 2019, 04:37 PM) yes i did that..but i want it to count as seconds
|
|
|
|
|
|
cytyler
|
Apr 10 2019, 04:57 PM
|
|
QUOTE(Walaweiii @ Apr 10 2019, 04:44 PM) yes i did that..but i want it to count as seconds elaborate what u actually want to do ...its very brief with ur request
|
|
|
|
|
|
KanGz
|
Apr 10 2019, 05:04 PM
|
Getting Started

|
QUOTE(Walaweiii @ Apr 10 2019, 04:44 PM) yes i did that..but i want it to count as seconds #3 post already answer you you received 3 seconds from user input, then convert to ms equal to 3000. x.Interval = 3000; x.Start(); thats all.
|
|
|
|
|
|
Eventless
|
Apr 10 2019, 05:57 PM
|
|
If an object requests a value to be in the form of millisecond, you provide the value in millisecond. If you don't like that option, your other option would be to create a new control based on timer that accepts the interval value in seconds.
|
|
|
|
|
|
kevinlim001
|
Apr 11 2019, 09:35 AM
|
|
you can create your own function if u wan insist on your second interval instead of milisecond interval
This post has been edited by kevinlim001: Apr 11 2019, 09:35 AM
|
|
|
|
|
|
CKKwan
|
Apr 11 2019, 09:39 AM
|
|
User enter 3
3 x 1000 = 3000 ms = 3 s
TS failed kindergarten maths gah?
|
|
|
|
|
|
turnmoil
|
Apr 11 2019, 10:47 AM
|
|
just convert by some math calculations... there is no direct method for it..
but not that hard also
|
|
|
|
|
|
Moshpit94
|
Apr 11 2019, 02:41 PM
|
|
Just do conversion la... CODE Dim ts As TimeSpan = TimeSpan.FromMilliseconds(milliseconds) MessageBox.Show(ts.Minutes.ToString & " minutes and " & ts.Seconds.ToString & " seconds") MessageBox.Show("Total Minutes: " & ts.TotalMinutes.ToString) MessageBox.Show("Total Seconds: " & ts.TotalSeconds.ToString)
|
|
|
|
|
|
lantaurus
|
Jun 2 2019, 06:12 AM
|
New Member
|
|
|
|
|
|
|
Alphaseti P
|
Jun 2 2019, 09:56 PM
|
New Member
|
timer object is in miliseconds. Therefore, conversion to objecti (as in timer) would be x(seconds) X 1000 (constant to milliseconds) as per required by the object reference.
Eg: ' Timer1.Interval --> this is in ms Timer1.Interval = 2000; ' 2 Seconds Timer1.Start() '
|
|
|
|
|