i need timer interval more than 1 Minute.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tark Siala

    i need timer interval more than 1 Minute.

    hi
    i am using timer control, its good but if my event doing less than one time
    in 1 Minute.
    i want make event every 5 minute, how i can do that?

    i am using VB6, VB.NET

    --
    Best Regards

    Tark M. Siala
    Development Manager
    INTERNATIONAL COMPUTER CENTER (ICC.Networking )
    Mobile: +218-91-3125900
    E-Mail: tarksiala@icc-libya.com
    Messenger: tarksiala@hotma il.com
    Web Page: http://www.icc-libya.com
    Blog: http://spaces.msn.com/tarksiala
    =============== =============== ========


  • Sankalp

    #2
    Re: i need timer interval more than 1 Minute.

    You can assign the interval of your timer on form load to some value.
    e.g. if your timer is Timer1, then
    on form load :-
    Timer1.Enabled = True
    Timer1.Interval = 300000 ( 5 minutes)

    This will fire the Timer1_Elapsed event where you can do your
    processing.

    -S

    Comment

    • Jason

      #3
      Re: i need timer interval more than 1 Minute.

      in VB.net (not sure about 6...)

      a timer with the interval of 1000 = 1000ms which = 1 s

      so for 1 minute 60 * 1000 = 60,000

      so for 5 minutes 60 * 5000 = 300,000



      "Tark Siala" <tarksiala@ic c-libya.com> wrote in message
      news:eQbhNBmXGH A.508@TK2MSFTNG P02.phx.gbl...[color=blue]
      > hi
      > i am using timer control, its good but if my event doing less than one
      > time in 1 Minute.
      > i want make event every 5 minute, how i can do that?
      >
      > i am using VB6, VB.NET
      >
      > --
      > Best Regards
      >
      > Tark M. Siala
      > Development Manager
      > INTERNATIONAL COMPUTER CENTER (ICC.Networking )
      > Mobile: +218-91-3125900
      > E-Mail: tarksiala@icc-libya.com
      > Messenger: tarksiala@hotma il.com
      > Web Page: http://www.icc-libya.com
      > Blog: http://spaces.msn.com/tarksiala
      > =============== =============== ========
      >[/color]


      Comment

      • Bob Butler

        #4
        Re: i need timer interval more than 1 Minute.

        "Jason" <jason@genzling er.com> wrote in message
        news:%23vD70GmX GHA.4120@TK2MSF TNGP03.phx.gbl[color=blue]
        > in VB.net (not sure about 6...)
        >
        > a timer with the interval of 1000 = 1000ms which = 1 s
        >
        > so for 1 minute 60 * 1000 = 60,000
        >
        > so for 5 minutes 60 * 5000 = 300,000[/color]

        In VB6 the timer control is limited to 65535 so the usual method there is to
        save the time ina module-level or static procedure level variable, set the
        timer to 60000 (or any value >0 and <65536) and then when the timer event
        fires compare "Now" to the saved time to determine if you have reached the
        desired interval.

        --
        Reply to the group so all can participate
        VB.Net: "Fool me once..."

        Comment

        • Karl E. Peterson

          #5
          Re: i need timer interval more than 1 Minute.

          Sankalp wrote:[color=blue]
          > You can assign the interval of your timer on form load to some value.
          > e.g. if your timer is Timer1, then
          > on form load :-
          > Timer1.Enabled = True
          > Timer1.Interval = 300000 ( 5 minutes)[/color]

          Not in ClassicVB, you can't!
          --
          Working without a .NET?



          Comment

          • Jason

            #6
            Re: i need timer interval more than 1 Minute.

            perhaps its time for an upgrade? ;)


            "Karl E. Peterson" <karl@mvps.or g> wrote in message
            news:O%23qGkxmX GHA.4324@TK2MSF TNGP03.phx.gbl. ..[color=blue]
            > Sankalp wrote:[color=green]
            >> You can assign the interval of your timer on form load to some value.
            >> e.g. if your timer is Timer1, then
            >> on form load :-
            >> Timer1.Enabled = True
            >> Timer1.Interval = 300000 ( 5 minutes)[/color]
            >
            > Not in ClassicVB, you can't!
            > --
            > Working without a .NET?
            > http://classicvb.org/
            >
            >[/color]


            Comment

            • Karl E. Peterson

              #7
              Re: i need timer interval more than 1 Minute.

              Jason wrote:[color=blue]
              > perhaps its time for an upgrade? ;)[/color]

              Ah yes, if only there were... (Signed the petition, yet? ;-)
              --
              Working without a .NET?



              Comment

              • Saga

                #8
                Re: i need timer interval more than 1 Minute.

                This is what happens when the query is crossposted to Classic and .NET
                groups :-)

                Regards
                Saga


                "Karl E. Peterson" <karlNON@SPAMME mvps.org> wrote in message
                news:O%23qGkxmX GHA.4324@TK2MSF TNGP03.phx.gbl. ..[color=blue]
                > Sankalp wrote:[color=green]
                >> You can assign the interval of your timer on form load to some value.
                >> e.g. if your timer is Timer1, then
                >> on form load :-
                >> Timer1.Enabled = True
                >> Timer1.Interval = 300000 ( 5 minutes)[/color]
                >
                > Not in ClassicVB, you can't!
                > --
                > Working without a .NET?
                > http://classicvb.org/
                >
                >[/color]


                Comment

                • Ken Halter

                  #9
                  Re: i need timer interval more than 1 Minute.

                  "Jason" <FBomb@j.com> wrote in message
                  news:%23yI1izmX GHA.1476@TK2MSF TNGP03.phx.gbl. ..[color=blue]
                  > perhaps its time for an upgrade? ;)
                  >[/color]

                  Nah... you'll find out the first time that 5 minutes is up and the OS has
                  swallowed a timer event <g>

                  Personally, I set the tick to about once per second (depending on a few
                  things) and use DateDiff to figure out if a certain amount of time has
                  elapsed. Timer events are just to flakey to rely on. By doing the math
                  myself, I eliminate the OSs ability (for the most part) to ruin my timing.

                  --
                  Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
                  DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm


                  Comment

                  • Karl E. Peterson

                    #10
                    Re: i need timer interval more than 1 Minute.

                    Saga wrote:[color=blue]
                    > This is what happens when the query is crossposted to Classic and .NET
                    > groups :-)[/color]

                    Exactly. Two languages, two answers.
                    --
                    Working without a .NET?



                    Comment

                    • PulsarSL@gmail.com

                      #11
                      Re: i need timer interval more than 1 Minute.

                      dim interval as long
                      dim ticked as long

                      long = 30000 'or your time, in seconds
                      ticked=0

                      Private Sub Timer1_Timer()
                      ticked = ticked + 1
                      if ticked = interval then call yourfunction
                      end sub

                      Comment

                      • Karl E. Peterson

                        #12
                        Re: i need timer interval more than 1 Minute.

                        PulsarSL@gmail. com wrote:[color=blue]
                        > dim interval as long
                        > dim ticked as long
                        >
                        > long = 30000 'or your time, in seconds
                        > ticked=0
                        >
                        > Private Sub Timer1_Timer()
                        > ticked = ticked + 1
                        > if ticked = interval then call yourfunction
                        > end sub[/color]

                        Yeah, that's one idea (though I'd use Static procedure vars, myself), but as
                        others have pointed out this method is vulnerable. You are hearby
                        admonished to write, 1000 times, on the blackboard:

                        "Windows is not a real-time operating system."
                        "Windows is not a real-time operating system."
                        "Windows is not a real-time operating system."
                        "Windows is not a real-time operating system."
                        "Windows is not a real-time operating system."
                        "Windows is not a real-time operating system."

                        --
                        Working without a .NET?



                        Comment

                        • Rich M

                          #13
                          Re: i need timer interval more than 1 Minute.

                          I usually set the Interval to 60000 (1 minute) and use the Timer's Tag
                          property as a minute counter:

                          Private Sub Timer1_Timer()
                          If Val(Timer1.Tag) < 4 Then
                          ' Increment minute counter
                          Timer1.Tag = Val(Timer1.Tag) + 1
                          Else
                          ' Do actual stuff every 5 minutes

                          ' Reset minute counter
                          Timer1.Tag = "0"
                          End If
                          End Sub


                          "Tark Siala" <tarksiala@ic c-libya.com> wrote in message
                          news:eQbhNBmXGH A.508@TK2MSFTNG P02.phx.gbl...[color=blue]
                          > hi
                          > i am using timer control, its good but if my event doing less than one
                          > time in 1 Minute.
                          > i want make event every 5 minute, how i can do that?
                          >
                          > i am using VB6, VB.NET
                          >
                          > --
                          > Best Regards
                          >
                          > Tark M. Siala
                          > Development Manager
                          > INTERNATIONAL COMPUTER CENTER (ICC.Networking )
                          > Mobile: +218-91-3125900
                          > E-Mail: tarksiala@icc-libya.com
                          > Messenger: tarksiala@hotma il.com
                          > Web Page: http://www.icc-libya.com
                          > Blog: http://spaces.msn.com/tarksiala
                          > =============== =============== ========
                          >[/color]


                          Comment

                          • Cor Ligthert [MVP]

                            #14
                            Re: i need timer interval more than 1 Minute.

                            Tark,

                            In VBNet in at least 3 (4) different methods. This dependend if you use it
                            for a Form, a windowsservice or a multithreading application. For Webforms
                            will in the Atlas part as well a clientside timer be included.

                            Beside that can you in windowforms VBNet as well stop the processing one
                            minute or longer and get mostly the same effect.

                            I hope this helps,

                            Cor


                            Comment

                            • Michael C

                              #15
                              Re: i need timer interval more than 1 Minute.

                              "Rich M" <rmabry-nospam@jaguartc .com> wrote in message
                              news:OZSx8yoXGH A.1348@TK2MSFTN GP05.phx.gbl...[color=blue]
                              >I usually set the Interval to 60000 (1 minute) and use the Timer's Tag
                              >property as a minute counter:[/color]
                              [color=blue]
                              > Timer1.Tag = Val(Timer1.Tag) + 1[/color]

                              Yuk!

                              Michael


                              Comment

                              Working...