How do i use a timer

How do i use a timer bit of a stupid question but it has puzzled me! I would also like to know how to link VB with databases i am currently working on a project and i need some help.


Answer this question

How do i use a timer

  • angle

    I am doing a access project so i am using VB but i want to code so i can link VB and access together

    And what do you mean by tick_time event isn't there an easier method



  • WoodyIS

    Good point.

    I think this was the reasoning behind the area on the form that is not part of the User Interface like VB class had, where the timers would be on the form although invisible at run time.

    But the basic premise of properties and methods of the timer control still apply. Just that you create timer control in code rather than drag/drop onto form.

    Database access shows

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=321976&SiteID=1


  • Ffelagund

    Sure - at the end of the day, the same thing is created. For me, though, putting it in code means having complete control over it, where it is declared, how it is declared, etc. The designer does indeed have that area, and it's obviously so that more and more can be done without writing code, which is fine for some folks, I suppose.



  • larkinyoung

    How easy do you want it...

    You drag/drop the timer control on the form.

    Set the interval property in property window (or code)

    Double click the control - will create the timer_tick event that you put your code into.

    and then all your doing is calling a start / stop event.

    We are talking being able to setup a timer in 30 seconds.... I cant think of anything that could be simpler.


  • sko

    Using a timer....

    Drop a timer control on the form

    Set the Interval Property of the timer control
    Put some code in the Timer_Tick event

    Call the timer control start method

    and every interval specified you code in the tick event will be run.

    To stop the timer call the .stop method.

    Linking with databases

    Thats a big open ended question - any more specific questions as there are numerous resources on accessing databases (which database in particular what are you trying to do )


  • javarg

    I would recommend just creating a timer as a member variable in code. In my mind, things like database connections and timers don't belong on the form, that's just drag and drop stuff that's offered for people who don't want to do any programming :-)



  • wjcampbe2

    With regard to the first question - there is a ton of info on the web about using VB.NET with Access.

    http://www.google.com.au/search hl=en&q=vb.net+access+&meta=

    As to the second, no there is no easier way. No matter what happens, you're writing a program, and that means code. In this case, you need code that runs when the timer executes. That would be the point of having a timer :-) The tick_time event is a function that is created to be called whenever the timer goes off. What did you want to do with the timer Whatever it is, you put the code to do that within this function.



  • How do i use a timer