-
Aug 12th, 2015, 08:30 AM
#1
Thread Starter
PowerPoster
[RESOLVED] subtracting one-second intervals from a timespan variable?
I have a TimeSpan variable in which I need to subtract 1 second from it but not sure how to do it? The value is the TimeSpan variable is set and then a Timer control is used to decrement the variable by 1 second intervals.
Thanks,
-
Aug 12th, 2015, 08:56 AM
#2
Re: subtracting one-second intervals from a timespan variable?
variable -= TimeSpan.FromSeconds(1)
-
Aug 12th, 2015, 09:11 AM
#3
Thread Starter
PowerPoster
Re: subtracting one-second intervals from a timespan variable?
Thanks passel...that worked great!
-
Aug 12th, 2015, 10:18 AM
#4
Re: [RESOLVED] subtracting one-second intervals from a timespan variable?
Originally Posted by blakemckenna
I have a TimeSpan variable in which I need to subtract 1 second from it but not sure how to do it? The value is the TimeSpan variable is set and then a Timer control is used to decrement the variable by 1 second intervals.
Thanks,
Are you aware that this approach is less accurate than others? If this is for short periods it will not matter, or maybe a few seconds is unimportant.
-
Aug 12th, 2015, 10:36 AM
#5
Thread Starter
PowerPoster
Re: [RESOLVED] subtracting one-second intervals from a timespan variable?
I've tested it and it works perfectly for what I'm doing...
If there is a better way, I'm all ears! I'm always trying to find better and more efficient ways of doing something.
-
Aug 12th, 2015, 12:00 PM
#6
Re: [RESOLVED] subtracting one-second intervals from a timespan variable?
Originally Posted by blakemckenna
I've tested it and it works perfectly for what I'm doing...
If there is a better way, I'm all ears! I'm always trying to find better and more efficient ways of doing something.
Here http://www.vbforums.com/showthread.p...=1#post4845569 is an example that does a count down.
-
Aug 12th, 2015, 01:00 PM
#7
Thread Starter
PowerPoster
Re: [RESOLVED] subtracting one-second intervals from a timespan variable?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|