Hack Forums
[.NET] [VB.NET] MinuteTimer [Timer from ms to minutes] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [VB.NET] MinuteTimer [Timer from ms to minutes] (/showthread.php?tid=118399)



[VB.NET] MinuteTimer [Timer from ms to minutes] - BETAhkr - Aug 7, 2009

A minute timer is a timer that allows you to have the interval in
minutes instead of milliseconds.
Such as.

Code
Timer1.Interval = 60000 ' 1 Minute
is now
Code
MinuteTimer1.Interval = 1 ' 1 Minute

Enter this code into your project
in a new class.
Code
Public Class MinuteTimer
    Inherits System.Windows.Forms.Timer

    Private _Minutes As Integer = 0

    Public Shadows Property Interval() As Integer
        Get
            Return _Minutes
        End Get
        Set(ByVal value As Integer)
            If value < 0 Then value = 0
            _Minutes = value
            Try
                MyBase.Interval = _Minutes * 60000
            Catch : Throw
            End Try
        End Set
    End Property

End Class
[IMG]http://i27.[censored].com/30wqasg.jpg[/IMG]

Save your project, Build your project, Then look at the top
You will see a component called "MinuteTimer"
[IMG]http://i30.[censored].com/fmupvs.jpg[/IMG]

Coding them MinuteTimer1 is the same as a real timer,
Except the Milliseconds to Minutes and instead of
just Timer1 It's MinuteTimer1.

Code
MinuteTimer1.Interval = 5 ' 5 Minutes



- [Chocobro] Nilef - Aug 8, 2009

Hey, this is good. First time i've ever seen someone post a component here. keep 'em coming.


- BETAhkr - Aug 8, 2009

Thanks for the good feedback.
As I said above, This is a great component for using long timed timers
in projects that don't want to do functions every 2 minutes or less.
or trying to figure out your milliseconds and looping it to be more than 65000ms.


- Romeo. - Aug 8, 2009

lol ... nice ...
i even don't know that ...

Thanks !


- BETAhkr - Aug 8, 2009

Yeah, There are a bunch of things people can do in vb2008 that people don't know
don't use or don't learn, and to be honest, A lot of them are pretty cool.


- The-Black-Raven - Aug 10, 2009

thanks mate, used a little project of mine


- BETAhkr - Aug 10, 2009

Well, The-Raven, Lets call it eve, Because I stole that banner thing
out of your sig and put it in mine. :P