Sie sind auf Seite 1von 34

Search

Visual Basic 6 (VB6)


Home Tutorials

RSS: Site Feed

Delay Timer

VB Code

VB Net

VB Tutorial

Understanding the timer control

Twitter: Visual Basic


Facebook: Visual Basic

Level:

Visual Basic Source Code


Countdown Timer
Download Visual Basic 6

Navigate To

MS Access VB Code
OpenGateSw.net/UI-Builder
Web 2.0 Menu Look & Feel in MS Access, Free Demo!
Written By TheVBProgramer.

Home

The TIMER Control

Tutorials
Source Code Samples
VB.NET Tutorials

The Timer control allows you to perform a task at a specified interval


or to wait for a specified length of time.

Add Your Tutorial

Timer Example 1

Forums
Articles
External Links
Advertise Here!
Contact Us

Guides
Beginner Guide
Controls Guide
Understanding forms
Timer control
Multiple Forms
Everything Images
Control arrays
Option Buttons
Check Boxes

Start a new VB project and place two command buttons and a


timer control on the form. Set the properties of the controls as
follows:
Control Property Value
Command Button (Name) cmdStart
Caption Start Timer
Command Button (Name) cmdStop
Caption Stop Timer
Timer (Name) tmrTest
Enabled False
Interval 250
Your form should look something like this:

Math Game
(o) Hangman
(o) Tic Tac Toe
(o) Calculator
(o) Cryptogram
(o) Concentration
Database Guide

User login
Username: *

Password: *

Log in
Create new account
Request new password

Consider the following facts about the Timer control:


It is not visible to the user at run-time
The actions that you want to happen at the specified
interval are coded in the Timer's Timer event.
You specify the interval that you want actions to occur in
the Timer control's Interval property. The value is
specified in milliseconds (1000 milliseconds = 1 second).
In the example, the value of 250 will cause the Timer
event to fire every quarter of a second.
You turn the timer "on" or "off" by setting its Enabled

property to True or False, respectively. The Enabled


property is set to True by default.
Place the following declaration in the Form's General
Declarations section:
Private mintCount As Integer
Code the Click event for the two command buttons and the
Timer event for the timer control as follows:
Private Sub cmdStart_Click()
mintCount = 0
Cls
tmrTest.Enabled = True
End Sub
Private Sub cmdStop_Click()
tmrTest.Enabled = False
End Sub

Private Sub tmrTest_Timer()


mintCount = mintCount + 1
Print "Timer fired again. Count = " &
mintCount
End Sub
Run the program. Click the "Start Timer" button. Messages will
appear on the form every quarter of a second. They will stop
when you click the "Stop Timer" button. A sample run might look
like this:

Download the VB project code for the example above here.


Timer Example 2
The Timer control can be used to make an object on your screen
appear to blink. This is done by toggling the Visible property of the
object on and off at short intervals. The Visible property is available
to nearly all controls it is a Boolean property that determines
whether or not the control is visible to the user at run time by setting
its value to True or False (it will always be visible at design time).
To build a simple demo, perform the following steps.
Start a new VB project.

Place a label on the form and name it lblProcessing. Set its


Caption to Processing . . . Please Wait. Set it to a large font and
set its Forecolor property to the color of your choice. Center it on
your form.
Place a timer on the form and name it tmrBlink. Set its Interval
property to 250.
In the tmrBlink_Timer event, place the following single line of
code:
lblProcessing.Visible = Not
lblProcessing.Visible
Run the project. The label will blink. After an appropriate period
of observation, close the form.
Download the VB project code for the example above here.

Similar links
Cara Memperbesar Buah Dada
entre otros.Bootcamp Gesundheit
Babak Final Liga Champions 2013
Prediksi Getafe vs Real Sociedad
Cara Terbaik Mengatasi Ejakulasi Dini
Cewek Cantik Kelihatan Celana Dalam Tanpa Sensor
Pantun Jenaka
Yoyoipads.com - get free ipad anywhere

- ?

If you enjoyed this post, subscribe for updates (it's free)


Email Address...

Please Help!!!! I need to

Subscribe

Fri, 10/26/2012 - 18:16 Domi (not verified)

Please Help!!!!
I need to create a Time Calculator in Visual Basic 2010
Create a VB application that lets the user enter a number of seconds and works as
follows:
- there are 60 seconds in a minute. If the number of seconds entered by the user is
greater than or equal to 60, the program should display the number of minutes in that
many seconds.
- there are 3,600 seconds in an hour. If the number of seconds entered by the user is
greater that or equal to 3,600, the program should display the number of hours in that
many seconds

- there are 86,400 seconds in a day. If the number of seconds entered by the user is
greater than or equal to 86,400, the program should display the number of days in that
many seconds.
reply

excellent tutorial.i know vb

Sat, 08/25/2012 - 03:09 Hema Suresh (not verified)

excellent tutorial.i know vb basics.but dont have much idea about vb6.i found this tutorial
much helpfull and easy to learn. thanks for giving this
reply

how i enter data in


database at run time in vb6

Sat, 07/07/2012 - 02:09 dinesh sharma (not verified)

plz;
send this code soon.........
reply

can you use 1 timer to get

Sat, 06/23/2012 - 09:11 Anonymous (not verified)

can you use 1 timer to get things done at different times.


I wanna show 3 lines at different times with one timer
reply

Timer

Sun, 06/17/2012 - 05:53 beginner (not verified)

Hi
M very new to vb and m trying to create a small game. I have 4 picture box n i want the
pic to b loaded in the first box as soon as i run it and the 2nd box shud display the pic
after 1s and the 3rd 1 sec aftr the 2nd displays n so on. How can i use timer for tis???
Pls help me out with this.M using vb 2010.Expecting a rly sooner.
Thanks in advance.
reply

Refresh timer for web page

Tue, 06/12/2012 - 06:44 David G (not verified)

Hi! I'm a total newb to VB but I'm trying to make a timer to refresh a web page and display
it on a framless window. I've got the window part down but I cant figure out the timer
module. Maybe a 60 minute refresh would work for it....
reply

THANKS

Sat, 06/09/2012 - 00:51 CHRISTOF BEKKER (not verified)

I LIKE THIS PAGE. I KNEW NOTHING ABOUT TIMERS. NOE I'M AN EXPERT.
I LIKE TO THANK YOU FOR THIS FINE HELP.
NICE DAY
reply

help me guys

Sat, 02/18/2012 - 09:04 Anonymous (not verified)

how can i move the car .. moving car only .. thanks!


reply

vb6

Fri, 01/20/2012 - 21:01 ronie (not verified)

please give me a code of a program that if the user entered a wrong username and/or
password, the message box will prompt "invalid entry, try again". And after three(3)
attemps of wrong entry, message box "Program will end".....
thanks..!:)
reply

The Code :)

Sat, 03/30/2013 - 09:47 OneOfVB6Programers (not verified)

This is just one idea:


1. cmdLogin is button for logging in,
2. txtUser is textbox in which user is typing username,
3. txtPass is textbox in which user is typing password.
4. example username is 'default' and example password is 'sesame'. You should
change them in 7th and 8th line of code.
K, let's write the code:
Private Sub cmdLogin_Click()
Dim i
a$ = txtUser.Text
b$ = txtPass.Text
i=0
Do
If a$ <> "default" Or b$ <>_ "sesame" Then
i = i +1
Msgbox "Invalid entry!",,"Error (" & i & ")"
Else
Msgbox "Correct username and password!",,"Correct"
goto thisisend
End If
Loop Until i = 3
Msgbox "Program will end",,"End"
End
thisisend:
End Sub
reply

username and/or password


Verification

Sun, 01/29/2012 - 08:15 programmermja

The Code you are looking for depend on what Kind of Username and/or password
you what to verify, that is to say if the Username and/or password is stored in a
Database.
The example Codes below is for Username and/or password stored in a Database
and if the Username and/or password dose not match with what is in the database it
will bring up a message box.
I hope it will help.
Private Sub CmdLogin_Click()
Dim varbookmark As Variant
Dim password As String
Set db = OpenDatabase(App.Path + "\data\SYSTEM.mdb") 'Location of your
Database
Set rs = db.OpenRecordset("users") 'Table in the Database where usernames and
passwords are stored
If TxtUsername.Text = "" Then
MsgBox "ENTER USERNAME TO PROCEED!", vbCritical, "Error..."
TxtUsername.SetFocus
Exit Sub
End If
If TxtPassword.Text = "" Then
MsgBox "ENTER PASSWORD TO PROCEED!", vbCritical, "Error..."
TxtPassword.SetFocus
Exit Sub
End If

With rs
.MoveFirst
.Index = "user_name" 'Ensure it is the same will the index in the Database
varbookmark = .Bookmark
.Seek "=", (TxtUsername.Text) 'Searching the Database to see if such username
exist
If .NoMatch Then
MsgBox "WRONG USERNAME", vbCritical, "FAILED"
.Bookmark = varbookmark
Exit Sub
End If
'Searching the Database to see if such password is for that username
If rs.RecordCount <> 0 Then
password = Trim(rs("password"))
End If
If password <> Trim(TxtPassword.Text) Then
MsgBox "Incorrect Password!", vbExclamation, "FAILED"
Else
Timer1.Enabled = True
End If
End With
End Sub
reply

Need help

Mon, 10/15/2012 - 00:57 blackrate (not verified)

Hi... please help me...


I want to create an application where the application will close itself when the
specified time has expired, can u help me please...
Warm Regards
reply

help

Sat, 12/03/2011 - 03:29 split (not verified)

Private Sub Timer1_Timer()


Dim a As Integer
a=0
a=a+1
If a Mod 2 = 0 Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End Sub
The above coding does not work for me in vb.Actually i want to make it look like a blink in
the form .plz help...
reply

Move the Dim statement

Sun, 03/25/2012 - 00:24 Anonymous (not verified)

Move the Dim statement outside of the subroutine. Right now, whenever
Timer1_Timer is called, a is reinitialized and resets itself to 0.
reply

YOU ROCKZZZ..!!!
YOU ROCKZZZ..!!!

Fri, 01/13/2012 - 06:14 Anonymous (not verified)

reply

Blinking label

Wed, 12/21/2011 - 19:49 tobee

Hi,
I assumed that your objective is to display a blinking label on your form. If that's the
case please take a look on the codes below.
'======================================================================
Option Explicit
Private Sub Timer1_Timer()
With Me
If .Label1.Visible Then
.Label1.Visible = False
Else
.Label1.Visible = True
End If
End With
End Sub
'======================================================================
I have used Timer object instead of an integer variable because that is the most
practical way if you only want to display a blinking label on your form.
I hope this can help.
Best regards,
Tobz
reply

Dim a As Integer a = 0

Sat, 12/17/2011 - 00:45 Anonymous (not verified)

Dim a As Integer
a = 0 <- each time the timer fire, your var a=0
a = a + 1 <- a=0+1=1 => in if clause a mod 2 = 1 mod 2
you should do this:
public a as integer
...
...
Private Sub Timer1_Timer()
a=a+1
If a Mod 2 = 0 Then
Label1.Visible = True
Else
Label1.Visible = False
End If
End Sub
reply

count down timer for each


command button

Sun, 11/20/2011 - 20:41 Arifin (not verified)

Dear all,
Please help me, i need source code for my project. i need to start/run port bit for parallel
port for running equipment as motor by timer. i have eight motors. for example i need to
start the motor at 07:00 AM and stop at 9:00 AM. and the others have a timer too
reply

port bit for parallel port

Thu, 01/12/2012 - 09:48 Anonymous (not verified)

You can write to adress &H378 (888) = (LPT1)


Qbasic / GWBasic
out 888,n n = 0..255 , i assume you know how binary works
works with DOS (is very fast) and window < XP ! (I use W98SE, network,
multitasking, USB..)
Just like in QBasic you can do the same in VisualBasic
VB6 is a litle more dificult becouse you need a DLL (< 10Kb) to be able to write to
hardware adresses.
With that DLL it is the same as in QB.
Look at : http://www.aaroncake.net/electronics/vblpt.htm , more explanation
and : http://www.softcircuits.com/ , for the DLL
winXP (and up): I don't know yet, becouse XP is to protective.
From here it should be easy
Grtz, CTP
reply

VB 6 Help me

Sun, 11/13/2011 - 06:42 Anonymous (not verified)

I wanted to make my program not to close without my permission.What i did for it is


entering codes as shown as bellow
Private Sub Form_Unload(Cancel As Integer)
If TxtPassWrd.text = "Password" then
end
else
Shell app.path & "\MyPrograme.exe"
end
end if
End Sub
when i try to close using Windows Task Manager > Application tab > right click on the
program name and > End Task, it worked well but,
when i close it "End Process" it did not work.....................
***********************************************************
If anyone know how to code it preventing close a program even Windows Task Manager
> End Process Please E-mail me or help me on this web..
Thank you,
reply

Service?

Tue, 02/28/2012 - 09:19 Anonymous (not verified)

Could this be done having an .exe file as a service? Won't windows try to restart a
service if it has failed?
Just a thought...
reply

hey i need help I got a

Sun, 11/06/2011 - 12:28 Andreas (not verified)

hey
i need help
I got a textbox and i have to know the source for get it sending a X number of messages.
It shall start with a button or a DomainUpDown
In visual basic 2011
reply

Simple Game

Thu, 11/03/2011 - 23:38 ErwaNs (not verified)

Please help about (label + timer with VB6)?


I have made the task of running text in vb6, ..
as follows:
labels for as many as four labels, + timer
label 1 runs from left to right,
label 2 runs from right to left,
label 3 runs from top to bottom,
label 4 runs from the bottom up,
rules of the game:
-within 10 seconds pause label 1 label 2, 3, 4 path
-within 20 seconds pause labels 2 labels 1, 3, 4 path
within 30 seconds, 3 labeling pause labels 1, 2, 4 path
-within 40 seconds pause label 4 labels 1, 2, 3 streets
with a note:
-after label stop and re-direct the path forward from the earlier cessation of ...
reply

vb

Wed, 10/31/2012 - 12:33 Anonymousjavid (not verified)

reply vb
reply

i think its superb....

Sat, 10/29/2011 - 02:13 sharad ranga (not verified)

i think its superb....


reply

images

Fri, 10/21/2011 - 21:59 calob fisher (not verified)

Hello i am trying to make an image visible but only for a certain amount of time then it
goes invisible again automatically but i can't seem to figure out how to do this.
reply

research

Mon, 09/19/2011 - 00:15 Anonymous (not verified)

....nice i have now an idea.. how to create this...


reply

Record count to vb6

Tue, 08/23/2011 - 18:23 ricky (not verified)

hi their every one


is their any way to count the records of recrodset i just connected my record using
database & i have to display the records in label please it urgent..
reply

logout and what you are doing


stops

Tue, 08/16/2011 - 09:54 stella (not verified)

i have cybercafe and most times bowsers will logout their time while downloading
something, and it is on my own expense. someone told me that, a cafe he visited, once
one's time logout, what he is doing stops. i need your hlep on please, is it a software or
what, 'cos i need it.... plz.

reply

Colour light

Thu, 07/07/2011 - 03:31 Supun (not verified)

In my vb form there are 3 circles that got in shapes control. Firstly i want to colour first
circle as green, second as yellow and third as red. This should be as colour light. Always
want to colour this colour light respectively. Please give codes to construct this
programme.
reply

Mon, 06/27/2011 - 07:58 Nick Cossentino (not verified)


Visual Basic 6 - Using
Timer1, cmd.exe, and prgbar1 together

objective: show progress while a command is being exicuted through the cmd.exe or
shell or some DOS command command.
showing progress for reading a text file is easy. I just get the record or line count and do
a loop until the max count is reached.
how do I show the progress of a shell command? what interupt or event or property must
I access?
I can see the cmd.exe icon in the task bar while i am executing a dos directory search.
what , how do i keep time of a shell command?
reply

Waiting before Close...

Thu, 06/02/2011 - 15:19 Esther (not verified)

So I'm creating a form in VB 2010 such that when you go to close the application, it wait 3
sec before it actually closes. I've looked all over for help with this and can only find how
to display the timer or delay the timer from starting. If anyone has any tips, that would be
awesome!!!!
reply

I'm trying to program an

Wed, 05/25/2011 - 07:43 Anonymous (not verified)

I'm trying to program an image to turn on after thirty seconds, to shut off three minutes
after the image appears, and to appear again after thirty seconds.
I know what the code would be, however, I cannot enter more than 65 seconds for the
interval property (the Visual Basic 6 Super Bible says the Interval property can range
from 0 ~ 65 seconds). Does anyone know of a way to loop a timer to increase the amount
of time enterable in the Interval Property?
reply

TIME IN AND TIME OUT

Sat, 05/14/2011 - 04:18 Anonymous (not verified)

and will also compute the days of absent ot hours and late .. please help me .. :) i need it
asap .. thank you ..
reply

TIME IN AND TIME OUT

Sat, 05/14/2011 - 04:09 Anonymous (not verified)

Help Me Please.. :'(


im actually doing payroll system ..
i need a code in a Time in and Time out ..
My program goes like this .
First the user need to put his employee number on a textbox then search it automatically
after he click the Search Button his employee name and position will appear on a textbox
..

then, he will click the time in button .. and it will be recorded .. supposedly that he click
again the time in , this time it will not be recorded a msgbox will pop-up that he already
log-in .. and in a time out button , it will also be recorded same with the time out if he
supposedly click again ..
reply

here is my own vb program,its

Sun, 05/08/2011 - 18:22 zhangxiannan

here is my own vb program,its really tear me down.could you guys help me?its
connected with MS excel..
let's say if i type place like Newyork,then i wanna the price is 20
if i type the place like Hawaii,then i wanna the price is 30
and all places of all others will be 40.
so the program i own its like :
function price(place as variant)as integer
if place=newyork then price=20
elseif place=hawaii then price=30
else price=40
end if
end function
reply

im not exactly sure what

Wed, 01/25/2012 - 09:40 Anonymous (not verified)

im not exactly sure what you're trying to do...


put a textbox and button on your form, then in the button:
Dim intPrice As Integer
If TextBox1.Text = "New York" then
intPrice = 20
elseif TextBox1.Text = "Hawaii" then
intPrice = 30
else
intPrice = 40
End If
reply

My dear frnd i'm new in


vb bt

Sun, 09/11/2011 - 09:50 Anonymous (not verified)

My dear frnd i'm new in vb bt wit wat u said u hv 2 declare ur d countrys txts as
variables
reply

automatic end time

Sat, 04/16/2011 - 08:45 Anonymous (not verified)

I am developing a cybercafe system. I am having a problem in calculating the end time, it


will display the end time automatically after the admin enter the duration for how many
hours the client wanted to play.Let say, the start time is 12:00, then there is a combo box
for admin to select how many hours the customer wanted to play and let say 2 hours. So
the there will be a text box to display the end time.in this case, the end time will show you
14:00. so i have 2 text boxes and 1 combo box which is for the duration.please i really
need your help.please send me the coding.
reply

Done!
I hope this code will help you in a way:
Option Explicit

Sat, 04/16/2011 - 17:22 ChrisGT7

Dim I As Byte
Private Sub Form_Load()
Combo1.AddItem "Select hours..."
For I = 1 To 23
Combo1.AddItem I
Next
Text1.Text = Format(Now, "dd/mm/yy - hh:mm:ss")
Combo1.ListIndex = 0
End Sub
Private Sub Combo1_Click()
If Combo1.ListIndex > 0 Then
Text2.Text = Format(Now + CDate(Combo1.ListIndex & ":00:00"), "dd/mm/yy hh:mm:ss")
Else
Text2.Text = Combo1.Text
End If
End Sub
Private Sub Text1_Change()
If Combo1.ListIndex > 0 Then _
Text2.Text = Format(Now + CDate(Combo1.ListIndex & ":00:00"), "dd/mm/yy hh:mm:ss")
End Sub
Private Sub Timer1_Timer()
Text1.Text = Format(Now, "dd/mm/yy - hh:mm:ss")
End Sub
Create a new form with 2 text boxes, 1 combo box and a timer. Make timer's interval
property to 1000 (1 sec) and paste the above code.
reply

plese help me cinditinal


propert of timer

Mon, 03/07/2011 - 03:33 sadanand (not verified)

I crete a login page in VB


OUR main aim to
enter the password in textbox if three time enter wrong password the textbox
will be disable for 90 second
please help me
as soon as
sadanand "MCA"
from Gurgaon HARYANA (BIHAR)
reply

in general: Dim

Wed, 01/25/2012 - 09:50 Anonymous (not verified)

in general:
Dim intLogInAttempts is Ingeter = 0
in a button:
If (your password/username is correct) then
(login)
else
intLogInAttempts = intLogInAttempts + 1
If intLogInAttempts = 3 then
intLogInAttempts = 0
Timer1.Enabled = True
(the log in button?).Enabled = False
End If
End If
in a timer:
(the log in button?).Enabled = True

i've only had about 12 weeks learing vb so i could be totally wrong


reply

AT LEAST POST AN
EXAMPLE OF

Mon, 04/11/2011 - 08:34 Anonymous (not verified)

AT LEAST POST AN EXAMPLE OF YOU TRYING IT BEFORE ASKING FOR


HANDOUTS.
reply

RE: plese help me cinditinal propert


of timer

Sun, 04/03/2011 - 23:51 tobee

Hi!
Please the code below.
Option Explicit
Private Const userName As String = "Admin"
Private Const password As String = "Pass"
Private noOfAttempts As Integer
Private Sub Command1_Click()
With Me
If .txtUsername.Text = userName And .txtPassword.Text = password Then
MsgBox "Access granted.", vbInformation, "Granted"
Rem To do
Else
MsgBox "Invalid username and/or password.", vbCritical, "Denied"
noOfAttempts = noOfAttempts + 1
If noOfAttempts = 3 Then
.txtUsername.Enabled = False
.txtPassword.Enabled = False
.Command1.Enabled = False
.tmrEnableTextboxes.Enabled = True
End If
End If
End With
End Sub
Private Sub tmrEnableTextboxes_Timer()
With Me
.tmrEnableTextboxes.Enabled = False
.txtUsername.Enabled = True
.txtPassword.Enabled = True
.Command1.Enabled = True
End With
End Sub
I hope this can help.
Best regards,
Tobz
reply

use sleep.

Mon, 03/07/2011 - 16:14 Anonymous (not verified)

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


Sleep 90000 '90s x 1000
reply

Save Log time

Thu, 02/10/2011 - 22:51 Anonymous (not verified)

Hi
Thanks for your codes on Internet cafe business
In VB 6.0 , I got an error while executing the below command.Is myTimeOutCon a
function ?
rsLoged.open mySQLcode, myTimeOutCon, adOpenDynamic, adLockOptimistic
reply

Timer continues after unload


form

Wed, 01/12/2011 - 02:54 Joergen (not verified)

Hi,
I manage a VB6 application, having lots of forms. The forms are loaded using at central
DialogManager-class.
One form has a timer-control, by default enabled. But by coincidence, I discovered that
the Timer continues after unloading the form, putting a debug.print into the timer1_timer
event. Even if I place a timer1.enabled = false in the form_queryunload, the timer is
continuing (prooved by debug.print in the timer-event).
Why is the timer not flushed when I unload the form, and how can I be sure to kill the
timer?
Thx
Joergen
reply

Kill prg

Mon, 03/07/2011 - 16:16 Anonymous (not verified)

Private Sub Form_Unload(Cancel As Integer)


End
End Sub
reply

timer=true/false what is this??

Thu, 12/16/2010 - 04:44 raama (not verified)

when I type timer=, it shows true or false. for what does this true or false used???
reply

it is used with

Thu, 12/15/2011 - 00:19 Anonymous

it is used with (.enabled).like this:- timer1.enabled=true/false..true is used to start the


timer.and false is used to stop the timer.
reply

when its true the timer will

Sat, 12/18/2010 - 20:47 some (not verified)

when its true the timer will start to count, when it false the timer will stay at 0
reply

youtube.com

Tue, 02/15/2011 - 02:04 Anonymous (not verified)

hi
every time i write this for some reason it ses error
tmrTest.Enabled = True
please help

reply

vb

Tue, 11/23/2010 - 01:59 Anonymous (not verified)

i want a vb code for develop a vb program to stimulate the traffic signals, by using the
following conditions.
I. Form consists of 3 signals Red,Green, & Yellow.
II.Form consists of one timer label, to display the time out signal.
III. While transorming the signal from Red to Green, Signal travel to Yellow.
IV. Time out for Red=180 sec.
V.. Time out for Yellow=60 sec.
VI. . Time out for green=120 sec.
reply

Delay While Reading a


File Line By Line

Mon, 10/18/2010 - 21:50 Kunal Maharaj (not verified)

hello Guys
I am new to VB and am implementing a project that transmits a file from server to client.
whilst displaying the contents of the file, i want to implement a delay (say 1sec delay) to
be incorporated between the lines as it is displayed.
i have no idea how to do this.
any suggestions?
please help
thanks
reply

Sat, 10/16/2010 - 14:25 Temitope (not verified)


to update database record at
certain interval say every 13hours

i'm being given a program to design an application i have designed it to monitoring


updated stocks and removes the stock as it's being sold.but the person want me to
include into the database daily updated record to the database but i dont know how to go
about it. pls i need code on how i can update the database with daily records.
reply

my program

Wed, 10/13/2010 - 04:18 Anonymous (not verified)

i want to have a code for time in / out of a employee.. in the form there's a textbox that will
display the number of hours of the employee worked base on the time in.. vb 6.0 code
pleasee..
reply

vb

Fri, 10/29/2010 - 00:56 Rajesh Laxmanrao Kathar (not verified)

i want more coding of timer control in vb 6.0. This coding will contain more
suffosticated to project or the software.
By using of timer controls we should be various effect to text .
i want some design of login screen.
reply

answer pls..

Sun, 09/05/2010 - 16:51 Ver (not verified)

how can i create a program that will display number 1-10 with delay without using a
timer?
reply

Without timer.

Tue, 09/14/2010 - 11:37 Tony Mahoney (not verified)

Create a delay routine, then print your number, call delay. It will return when delay is
done and you can print your next number.
Private sub PrintNumber()
dim x as integer
x=0
do
x=x+1
print x
Delay 5 'delay 5 seconds
loop while x<11
end sub
Public Sub Delay(l As Single)
Dim w As Single
w = Timer + l
If w > 86399 Then ' If midnight
w = w - 86400
Do While Timer > 0
DoEvents
Loop
End If
Do While Timer < w
DoEvents
Loop
End Sub
reply

HELP!

Thu, 09/09/2010 - 01:31 LetitiaAndAaron (not verified)

heyy we have to make a vb game for assessment and we would like to know how to
move something from one point to another.. someone please reply ASAP
thanx
reply

In a module called

Thu, 09/30/2010 - 04:33 Anonymous (not verified)

In a module called declarations add


Public Button1X,Button1Y as integer
no on the for load you want to give ButtonX, and ButtonY a value these should
the the start co-ordinates i.e. Button1X = 16 ButtonY=1, then you need the add
3 button events, Mousedown,MouseMove and MouseUp, these will control
what the mouse is doing.
then add the following code

]
Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) H
Dragging = True
StartX = e.X
StartY = e.Y
End Sub

Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArg


If Dragging = True Then
Button1.Left = (Button1.Left + e.X) - StartX
Button1.Top = (Button1.Top + e.Y) - StartY
End If
End Sub

Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)


Dragging = False
Button1X = Button1.Location.X
Button1Y = Button1.Location.Y
End Sub
</Blockcode>

hope that helps a bit

reply

move controls at run time

Mon, 08/30/2010 - 21:04 Anonymous (not verified)

Hello friends,
can u tell me how can i move control at run time?
controls like button,textbox etc....
reply

Hello

Tue, 06/29/2010 - 20:32 Yangkou

Can i download this lesson?


reply

Database

Mon, 06/28/2010 - 11:20 Nur (not verified)

There are three text boxes( text1, text2 & text3) on a form bound to a database table.
text1 and text2 are bound to fields of the table. I want to show the value of multiplication
of two boxes. Plz reply. thanks.
reply

timer on all forms

Thu, 05/06/2010 - 21:34 Anonymous (not verified)

i need a timer in all forms..the timer control is in form 1 then the time countdown activates
in all other forms.. is it possible? please help me!
reply

. yes it is possible. put


an

Tue, 08/17/2010 - 05:47 Anonymous (not verified)

. yes it is possible.
put an label to your form rename it lbltimer , change the text to "0" then
put this code in lbltimer
lbltime.Text = lbltime.Text + 1
If lbltime.Text = 5 Then
btnOK.Enabled = True
Timer1.Stop()
Form2.Show()
Me.Hide()
.....VB 8 codes !
reply

VB 6 animation program.

Wed, 04/14/2010 - 19:18 itm (not verified)

Hi there!
I made one simple vb 6 program. I did one animation of one engine running and one fan
or cooler runnig too. It individually runnig if I push Start button of it object either engine or
fan. The question is. I would like to add two buttons one Auto and another Manual. When
I push or click the Manual button the fan can not running If I start engine. Did you get the
point? I did engine runnig together with fan or cooler but I would like to add those two
buttons. If I push Auto the two engine and cooler can running together but if I push
Manual button the cooler can not running until I change pushing Auto button. Did you get
it?
reply

Hi I really need help. I

Sun, 04/11/2010 - 11:37 Anonymous (not verified)

Hi I really need help. I want to make a program where when i click on a button the timer
starts to make labels appear with intervals of 5 seconds....should i make a specific timer
for each button? and how do i call the timer function in the required button?
reply

.put an label to your form

Tue, 08/17/2010 - 05:50 Anonymous (not verified)

.put an label to your form rename it lbltime , change the text to "0" then
put this code in your button
lbltime.Text = lbltime.Text + 1
If lbltime.Text = 5 Then
btnOK.Enabled = True
Timer1.Stop()
reply

Regarding timer

Fri, 03/12/2010 - 03:41 Rawat (not verified)

I m new to VB6 and I want to display time in visual basics 6.0 i.e in the this manner
00:00:01, 00:00:02, 00:00:03 and so on.. and that too one after the other.. can we do
this? plz reply m badly in need
reply

Counter Timer request

Wed, 05/26/2010 - 17:07 wfc_wallin.fact...

'Just mail me at voicaalin30@yahoo.com for any problems.


'As you can see i am not using any commands buttons
'just labels.
'Just put 12 labels like me and copy and paste the code.
'My first 6 labels have caption 0 (zero)
'label 7 and 8 with caption :
'label 9 as Start
'label 10 as Stop
'label11 as Resume ' or continue
'label 12 as Reset
Private Sub Form_Load()
Me.Caption = Date
Label11.Visible = False
Label10.Enabled = False
End Sub
'Label Stop
Private Sub Label10_Click()
Timer1.Enabled = False
Label10.Visible = False
Label11.Visible = True
Label9.Enabled = False
End Sub
'Label Resume
Private Sub Label11_Click()
Timer1.Enabled = True
Label11.Visible = False
Label9.Enabled = False
Label10.Visible = True
End Sub
'Label Reset
Private Sub Label12_Click()

Timer1.Enabled = False
Label9.Enabled = True
Label10.Visible = True
Label10.Enabled = False
Label11.Visible = False
Label1.Caption = 0
Label2.Caption = 0
Label3.Caption = 0
Label4.Caption = 0
Label5.Caption = 0
Label6.Caption = 0
End Sub
'Label Start
Private Sub Label9_Click()
Timer1.Enabled = True
Label10.Enabled = True
Label9.Enabled = False
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Label1.Caption + 1
If Label1.Caption = 10 Then
Label2.Caption = Label2.Caption + 1
Label1.Caption = 0
If Label2.Caption = 6 Then
Label3.Caption = Label3.Caption + 1
Label1.Caption = 0
Label2.Caption = 0
If Label3.Caption = 10 Then
Label4.Caption = Label4.Caption + 1
Label1.Caption = 0
Label2.Caption = 0
Label3.Caption = 0
If Label4.Caption = 6 Then
Label5.Caption = Label5.Caption + 1
Label1.Caption = 0
Label2.Caption = 0
Label3.Caption = 0
Label4.Caption = 0
If Label5.Caption = 10 Then
Label6.Caption = Label6.Caption + 1
Label1.Caption = 0
Label2.Caption = 0
Label3.Caption = 0
Label4.Caption = 0
Label5.Caption = 0
End If
End If
End If
End If
End If
End Sub
reply

countdown program

Fri, 03/05/2010 - 02:44 sarath (not verified)

Could any1 please send me a simple countdown program that displays the countdown
of 60 seconds on a label in a single form?
reply

your question

Fri, 10/21/2011 - 21:56 calob fisher (not verified)

what you have to do is first set a textbox i will just use text1 for the example, then you
need a timer. In the timers code area put the code text1.text = text1.text - 1. put the
number 60 in the textbox and set the interval speed on the timer to 1000 (this is the
equivalent of 1 second in timers)

reply

Count down

Thu, 04/01/2010 - 18:32 Anonymous (not verified)

Add a label to the form.


The label caption should be the starting amount ( eg: 60 )
Add a timer to the form.
Set the timer interval ( eg: 100 )
In the timer event, add the code...
Label1.Caption = Label1.Caption - 1
This will count down from 60...... Until you stop the timer.
( eg: If label1.caption = "0" the Timer1.enabled = false )
All the best!
reply

Hi Guys can any one guide


me

Sat, 02/13/2010 - 08:58 Anonymous (not verified)

Hi Guys can any one guide me on the vb code for Remote controlled car from pc parallel
port
I managed to write code for up,down,right,left, but i want guidance for preset path and
memories the path.
Thanks in advance.
reply

continuously count over and


over until required to stop

Tue, 02/09/2010 - 16:11 Anonymous (not verified)

Im new to VB6. Can anybody please help me how to create a simple program which is
intended to continuously count number from 1 up to 100 repeatedly without stopping
unless I press the button stop. At the same time, when I press stop button the screen will
show any random number.
Here's my code but something gets wrong everytime I run this. Can you please help me
figure out why this happen or could you please provide a better code.
Private Sub Command4_Click()
Dim x As Integer
Command5.Caption = "SELECT"
x=1
For x = 1 To 100
Text0.Text = x
If Command5.Caption = "STOP" Then
End
End If
If x=100 then
x=1
End if
Next x
End Sub
Private Sub Command5_Click()
Command5.Caption = "STOP"
Call Randomize
Text0.Text = 1 + Int(100 * Rnd())
End Sub
reply

The Solution

Sat, 08/14/2010 - 03:18 Utsav (not verified)

'The general Declarations


Private count10 As Integer
'The Command Box Which Starts The numbers moving from 1 to 100.
Private Sub Command1_Click()
'The next line should be used only if you want to to start from 0 every time you click
"Start"
'count10 = 0
Timer1.Enabled = True
End Sub
'The Command Box Which Stops The numbers moving from 1 to 100 and Displays a
Random Number.
Private Sub Command2_Click()
Randomize (1)
count10 = 0
Timer1.Enabled = False
count10 = Int(Rnd * 100)
Label1.Caption = count10
End Sub
'The Code to Be Executed On Form Load.
Private Sub Form_Load()
Timer1.Enabled = False
End Sub
'The Coding In The Timer Controls Timer Attribute.
Private Sub Timer1_Timer()
count10 = count10 + 1
If count10 = 100 Then
count10 = 1
End If
Label1.Caption = count10
End Sub
Objects Used.
2 Command Boxes
1 Label
1 Timer Control
Enjoy.......
And Thanks For The Exercise
reply

timer

Mon, 02/08/2010 - 11:53 Nishat

I want to make a project which will make a font smaller to larger and then it will back
larger to smaller at a time. I use this code but I made it half complete. its not working. it
makes the font size larger but I can not make it smaller.
the code I use
Private Sub label1_Load()
Label1.Fontsize = Label1.Fontsize + 5
End sub
Interval was 500 but its growing bigger and bigger. how I can stop it and how I can make
it smaller from the larger size.
It will be great help for me if any body can solve this problem
reply

This it is me code for your


request
I am using 2 timers to go back the action
and my logo on form load
Both timers must be enabled = false

Wed, 05/26/2010 - 17:48 wfc_wallin.fact...

with your interval preset.


The second label it is to have a stop and you can fix it as visible = false
I am a beginer in VB6 so i belive there must be a easy way to do this but this it is
my way
Private Sub Form_Load()
'label1.caption = "wfc"
Label1.FontSize = Label1.FontSize + 20
Timer1.Enabled = True
Label2.Visible = False
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Label2.Caption + 1
If Label2.Caption = 5 Then
Timer1.Enabled = False
Label1.FontSize = Label1.FontSize - 20
Label2.Caption = 0
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
Label2.Caption = Label2.Caption + 1
If Label2.Caption = 5 Then
Timer2.Enabled = False
Label1.FontSize = Label1.FontSize + 10
Label2.Caption = 0
Timer1.Enabled = True
End If
End Sub
reply

STOPWATCH with interval


REPORTER

Fri, 01/15/2010 - 12:49 Anonymous (not verified)

Hi,
I need a stop watch code in VB which be able to record and report:
1- how many times is being used?
2- the time of both pressing the START button and the STOP button
3- the total time duration
*** this program will be used to record the duration of breaks of the employees in a
company***
thanks alot...wait for your reply
reply

Using a timer within a


control structure

Tue, 12/15/2009 - 12:09 Anonymous (not verified)

I am trying to use a code segment as follows:


For I = 1 to 15
For J = 1 to 10
Count down from 30 seconds, displaying the countdown
Next J
Next I
If I put my countdown code within the Timer event, and have the timer set for a 1 sec
interval, having the Timer.enable in ForNext J, the nested ForNext structure has
completely executed before the Timer can complete the first interval. If I put a delay loop
controlled by a Done flag in the ForNext structure, we get an infinite loop and the
program crashes. Any help solving this problem would be greatly appreciated.
reply

How to display timer in


mm:ss:ms

Sat, 10/31/2009 - 09:14 Catherine088 (not verified)

Hello.
I would like to enquire regarding how to i go about displaying the timer in the format of
"mm:ss:ms" (min: sec: millisecond). Have been looking online for references for days,
tried out quite a number of codes too but dont seems to be able to find one as mostly are
those displaying in hh:mm:ss but i need it in milliseconds.
Hope to be able to find someone who can guide me on this as i'm pretty new in Visual
Basic. Thank you.
reply

Multiply/Divide?

Wed, 12/30/2009 - 09:05 wowaname (not verified)

I will use "timer" as the timer's name. "msCount", "secCount", and "minCount" will be
the respective time variables. Try setting timer's interval to 1 and:
Private Sub timer_Timer()
msCount = msCount + 1
If msCount > 1000 Then
msCount = msCount - 1000
secCount = secCount + 1
end if
If secCount > 1000 Then
secCount = secCount - 60
minCount = minCount + 1
End If
End Sub
Well darn, syntax highlighting doesn't work :P
Hopefully that should help!
reply

If you use > 1000 then


the

Fri, 02/26/2010 - 14:19 Anonymous (not verified)

If you use > 1000 then the timer will count to 1001 mili seconds before
switching. Should be >= 1000 or > 999
reply

Timer not working with


winsock

Sun, 09/27/2009 - 12:11 Anonymous (not verified)

Hi,
I'm developping an application that reads emails from a server.
I have set the interval of the timer1 to 1000 *30 (i.e. 30 seconds).
In the timer1_timer () subroutine I called another subroutine which makes a connection
with the server using
Winsock1.RemoteHost "hostname"
Winsock1.RemotePort "hosr port"
Winsock1.Connect
and then reads the emails etc.
then dissconnects from the server, and after 30 seconds or whatever repeats the cycle:
connecting to the server
reading emails
dissconnecting from the server.
The problem is that the timer run through the cycle mentioned above only once,
after 30 seconds it does not do anything.
Please help me.
Thanks a lot, appreciate your help
Aiman
reply

real time in vb

Tue, 09/15/2009 - 20:02 Xiao Pang (not verified)

anyone know how to write a code for real time counter? Means it can display like a
clock??
reply

Bad Code

Wed, 09/09/2009 - 14:29 Anonymous (not verified)

You above example


"
Private Sub cmdStart_Click()
mintCount = 0
Cls
tmrTest.Enabled = True
End Sub
Private Sub cmdStop_Click()
tmrTest.Enabled = False
End Sub
Private Sub tmrTest_Timer()
mintCount = mintCount + 1
Print "Timer fired again. Count = " & mintCount
End Sub
"
It doesnt work here, all that this produces is
Timer Fired Again. Count = 1
Timer Fired Again. Count = 1
Timer Fired Again. Count = 1
Timer Fired Again. Count = 1
You get the point, you should verify your code here, cause when I am learning i like to go
thru and try to creat it myself and I couldnt, so I tried copying your code and got the same
result... Wasted a half hour trying to find what I did wrong only to find my example code is
inncorrect. Its hard to fix the teachers code.. lol
Its casue you dont show to Declare the "Private mintcount as integer"
reply

Tue, 08/04/2009 - 03:13 Ramkumar (not verified)


how to show a label as a
welcome window using timer for 3 second

Hai Friends,
I finished my project of Production and Rejection related one using ADO. In I design a
welcome and license detail of my project.During MDI form initial it display for 3 seconds.
how to write code for that i paste the timer control in MDI form but i dont know how 2 write
code for this
Please help me
Thanks,
Ramkumar.C
reply

duration

Fri, 07/17/2009 - 21:45 yuki (not verified)

Can anyone help me how to make time duration?


i really don't know how...
hope you'll reply as soon as possible...please!!!!
Thanks
reply

thanks for provide me help

Sun, 07/05/2009 - 11:35 amar (not verified)

thanks for provide me help


reply

Timer controlbox not found

Wed, 07/01/2009 - 21:44 Basu K (not verified)

I want to create a splash screen in my excel project. For this I need a timer function. But
in the toolbox the timer button is not showing.
Can anyone please tell me how to add timer in the toolbox....???
reply

Delay Timer

Tue, 06/16/2009 - 10:10 barney roberts (not verified)

Trying to create a delay timer. Thus far all it does is lock up VB6
Trying to do something, wait some time frame, then proceed with next step of code.
Seem simple but I just don't get it.
Any insight would be greatly appreciated
thank you
Option Explicit
Dim Done As Integer
Dim uh As Integer
Private Sub Form_Load()
Done = 0
Timer1.Enabled = False
Timer1.Interval = 1000
Call RunThis
End Sub
Private Sub RunDelay()
Timer1.Enabled = True
Do
Loop Until Done <> 0
Exit Sub
End Sub
Private Sub RunThis()
uh = 1
Call RunDelay ' 1 second delay
uh = 2
End Sub
Private Sub Timer1_Timer()
Done = Done + 1
Timer1.Enabled = False
End Sub
<>
reply

Delay Timer

Tue, 07/14/2009 - 08:48 yeltsin (not verified)

The delay you created is not running because you do it when the form load into the
memory. When the timer1.enabled=true , the command is not working , so the
"done" variable is still 0. Then the computer still doing the loop till it get bug.
reply

Thanks ++ Question
Hello!

Sun, 04/26/2009 - 16:08 Anonymous (not verified)

I Love this site its exellent!


I Have a question...
Can you give me a code so like I Have a textbox. and i want to save what ive written in it.
well make a button for that to save. and a button to load the .txt file it was saves as ?
please give me a code for that i really need it!
thanks!
reply

too many timers?

Fri, 04/03/2009 - 14:45 huff (not verified)

I am writing a program that runs three forms at a time. Each of the three forms has three
timers of which, any two are running at a time. When I turn on the timers on the second
and third forms, the timers on the first form stop functioning. Whats up with this?? I have
done this before and it has always worked. Does anyone have a clue what could be
going wrong?
Thanks,
Huff
reply

About too many


timers

Thu, 04/09/2009 - 03:33 Rajendra Kumar.R (not verified)

About too many timers


reply

module

Mon, 01/05/2009 - 01:26 Module (not verified)

hey!!!...
someone can tell to me what is the proper way to declare in module??.... and what is the
easier way to declare??...
email me at: dinzkie006@yahoo.com
reply

timer countdown easy

Sun, 12/28/2008 - 10:01 Don (not verified)

if yah want to countdown thn use:


Dim i as integer
private sub form_load()
i=5000 '50 sec's
timer1.interval=1
timer1.enabled=true
end sub
private sub timer1_timer()
i=i + 1
lbl1.caption="i"
if i = 0 then
i=i -1
lbl.caption= "i"
end
end if
end sub
simple countdown!
reply

timer

Mon, 12/08/2008 - 23:53 Anonymous000 (not verified)

help me.....help me.....plzzzz!!!!!!


i wish to know to make a timer or a clock for the log in and log out....for example....the

user use the computer and he/she log in the time when he/she start and compute the No.
of hours after he/she use the computer...
i hope you answer my question. i need it on my project..
Thanks!!
reply

Save Log time

Tue, 12/09/2008 - 19:18 Ash (not verified)

HI, im on a project right now like a Internet cafe busines.


where there is a Server and a Client.
i have found a way to record the Log In time and the Log Out Time, and the Total
timed use.
using the ADODB and some SQL codes via MS access Database
where, when the user Log in, then it is recorded once Loged.
declaring this on a Module-----------------'create a new Connection
public myCon as new ADODB.connection
'create a new Record Set
public rsLoged as new ADODB.recordset
'create an event
Public Sub myEvent()
myCon.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=
"C:\...Location.mdb;persist Security Info=False"
myCon.CursorLocation = adUseClient
End Sub
modules ends here---------------------now on the form-----------------Private Sub Form_Load()
'call the event here
Call myEvent
'declare a variable
dim mySQLcode as string
'now some SQL codes must be added.
' ex: [Variable] = "select [*,Fields] from [table]"
mySQLcode = "Select * from LOGED"
'[recordset].open [variable], myTimeOutCon, adOpenDynamic, adLockOptimistic
'[recordset].movelast
rsLoged.open mySQLcode, myTimeOutCon, adOpenDynamic, adLockOptimistic
rsLoged.MoveLast
cmdLogOut.enable = false
form ends here-----------------------------------------------------------now on your Log in Button clicked.
'asuming i have 3 fields in my DBase, and 2 buttons
'field(0) = Log In
'field(1) = Log Out
'field(2) = Total Time.
'On Log In
private sub cmdLogin_clicked()
dim myLogin as string
myLogin = time
SS = 0
MM = 0
HH = 0
timer1.enable = true

timer1.interval = 1000
'the rest you want to add on then button
end sub
'On Log Out
private sub cmdLogOut_clicked()
rsLoged.movelast
rsLoged.addnew
reLoged.fields(0) = myLogin 'this is the variable you declare on the login button
reLoged.fields(1) = time 'this is the system time
reLoged.fields(2) = lblTimer 'this is a label contaning the Time Consumed
rsLoged.Update
end sub
----------------------------------'time consumed is the set apart by Hours, Minutes and Seconds
declaring HH, MM, SS as integer will do.
and HO, MO, SO as string
on a timer1
private sub timer1_timer()
SS = SS + 1
With lblTimer
If SS >= 10 Then
SO = "" & SS
End If
If MM >= 10 Then
MO = "" & MM
End If
If HH >= 10 Then
HO = "" & HH
End If
.Caption = HO & ":" & MO '& ":" & SO this is invisible.
End With
end sub
'this is working for me, this will not compute for the interval of the Log in and Log out
but
'lets say it does cause it display the time consumed from the time you Log In
'i.e. Login:1:00pm; Logout:2:25; Consumed:1:25;
end sub
------------------------------now for viewing the record-------------on a new form
add a datagrid view on the form 'get it on the components
private sub form2_load()
Dim SQLTimeOut As String
SQLTimeOut = "select * from LOGED"
rsLoged.open SQLTimeOut, myTimeOutCon, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = rsData
end sub
'thats all: HOPE this is HELPUL to you
(^_^),\m/
reply

I Forgot to..

Tue, 12/09/2008 - 23:26 Ash (not verified)

remember the timer1_timer()?


Im sorry, i forgot the timer, its incomplete.
here is the complete code for it :)

Private Sub TimerStart()


SS = SS + 1
HO = "0" & HH
MO = "0" & MM
SO = "0" & SS
with lblTimer
If SS >= 10 Then
SO = "" & SS
End If
If MM >= 10 Then
MO = "" & MM
End If
If HH >= 10 Then
HO = "" & HH
End If
.Caption = HO & ":" & MO '& ":" & SO this is invisible
end with
'this is what i forgot to enter.
'this is the counter actualy
'when SS = 59, the MM will increment by 1, and same to HH when MM does.
If MM = 59 And SS = 59 Then
HH = HH + 1
MM = 0
SS = 0 - 1
consPrc = consPrc + 20
Else
If SS = 59 Then
MM = MM + 1
SS = 0 - 1
End If
End If
End Sub
reply

Timer

Thu, 02/03/2011 - 19:29 Alvin (not verified)

Thanks a lot for this code. ...... Thanks....thanks...


reply

tutorials

Mon, 11/24/2008 - 03:35 shoperoo (not verified)

I just wanted to thank you for your tutorials I am a mature student trying to learn vb . I get
2 hours tuition per week.
The jargon used in books and some other tutorials make it very difficult to advance
therefore simply explained procedures are much appreciated
Thank you for your efforts
reply

my question is....

Wed, 10/22/2008 - 05:59 Anonymous (not verified)

how to move text on form with the help of timer control......


plz do answer.........
reply

if you still need help ....

Fri, 10/23/2009 - 06:51 jerry (not verified)

if you need help with code send it to me and tell me what you want...i will fix it and
highlight all changes....happy coding...
reply

payroll

Sun, 09/05/2010 - 18:08 Anonymous (not verified)

please help me on my time log codes in my payroll system


reply

timer counting down

Thu, 10/09/2008 - 06:44 Anonymous (not verified)

i need help on a timer with a label displaying the time 30 sec's counting down to 0
need help badly
reply

Counting down from 30 sec


to 0

Thu, 03/12/2009 - 09:29 Archer (not verified)

Hey guy, try this.


First set timer interval to 1000
Dim i as integer
Private Sub Form_Load()
i = 30
End sub
Private Sub Timer1_timer()
i=i-1
label1.Caption = i
If i = 0 then Timer1.Enabled = False
End Sub
I think I'll work.
reply

not well done

Tue, 12/15/2009 - 22:10 argon (not verified)

it doesn't work at all


reply

IT Works... Thanks To
Previous Writer....

Sat, 08/14/2010 - 04:21 Utsav (not verified)

ALL THE CODING HAS BEEN DONE BY PREVIOUS PERSON.


I Just Added 1 Line.(In Bold)
3 Things have to be Done.
1 label (here it is Label1)
1 Timer Control(here it is timer1) [The interval property has to to set to 1000
(1000MillSec = 1 Sec)]
Dim i As Integer
Private Sub Form_Load()
i = 30
Timer1.Enabled = True
End Sub
Private Sub Timer1_timer()
i=i-1
Label1.Caption = i

If i = 0 Then Timer1.Enabled = False


End Sub
reply

countdown timer

Mon, 09/29/2008 - 19:47 Anonymous (not verified)

help me..help me.. plssssssss..need it badly..


can pls.. someone help me with my final project.. VB codes
i need help in coding my timer..
20:00(20 hrs.) with start - stop button..
and it should be visible..
thnxs..
reply

I would like to know how to

Fri, 09/26/2008 - 02:34 hellen (not verified)

I would like to know how to intergrate my forms


reply

how 2 enable timer from d


followin condition

Wed, 08/06/2008 - 09:31 Anonymous (not verified)

suppose i have 3 shapes as 1,2,3. these are coded in such a way with 3timers that firstly
1 is visible & others are not & after interval 1000, it bcomes invisible & 2 is now visible.
similarly this process repeats for 3 & again back for 1. if i want to enable another timer4
with a click of a command button when 1 is visible or timer5 when 2 is visible or timer6
when 3 is visible , then what code should i write on the click event of command button.
reply

You would simply use an if

Wed, 08/06/2008 - 09:48 Admin

You would simply use an if statement to see what shape is visible and then set the
correct timer to enabled as a result. Put this code in the Command button click
event:
' Disable all timers and then enable the appropriate one
timer4.enabled = false
timer5.enabled = false
timer6.enabled = false
if shape1.visible = true then
timer4.enabled = true
elseif shape2.visible = true then
timer5.enabled = true
elseif shape3.visible = true then
timer6.enabled = true
This should get you running. As you get it working would you please consider
writing a quick tutorial teaching some of what you've learned. You can write it in
Word or even as a text file and submit it through our Add Your Tutorial page. I think
others would benefit from everything your learning and its always cool to get
something published!
reply

help me plz

Mon, 08/25/2008 - 04:25 Anonymous (not verified)

im a student from the philippines. i cant figure out how can i do this scenario, i
have 1 label box but it can change its content by means of timer?? i cant do it..
can u help me....
1 label box
controlled by a timer

with different captions


plz help me thanks
reply

Tue, 07/29/2008 - 07:59 Tanya Persona (not verified)


three timers to work
together.... or setting two intervals...

Please!!! Help!!!
i need three timers working together. We're working on a timed-traffic-light project. The
traffic lights (red, yellow and green) need to blink alternately (ex: red glows red then after
interval yellow glows yellow then another interval and green flashes).
Do you know how?
Thanks anyways....
reply

hey guys i have problem


i

Tue, 02/02/2010 - 12:07 Anonymous (not verified)

hey guys i have problem i want to make game with shape and i dont know how to
put timer in. can u help me??
reply

stop watch ticking from 10 to 0

Sun, 02/10/2008 - 06:04 Anonymous

Can anyone help me???


I want to create a project but for that project i'll need a stop watch ticking from 10 to 0.
And i need to print how much time is left until watch get's to 0.
Please HELP!!!
reply

Private Sub

Sun, 08/08/2010 - 19:47 Anonymous (not verified)

Private Sub Form_Load()


Label1.Caption = 10
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Label1.Caption - 1
If Label1.Caption = 0 Then
MsgBox ("Time is out"), vbInformation
Timer1.Enabled = False
End If
End Sub
reply

Ten minute countdown


timer

Wed, 08/06/2008 - 05:23 Anonymous (not verified)

If you need it in seconds, adapt appropriately. Code for Timer Event :


Text1.Text = dMinute & ":" & dSecond
If dMinute = 0 And dSecond = 0 Then
Text1.Text = "Finished."
Exit Sub
End If
If dSecond = 0 Then
dMinute = dMinute - 1
dSecond = 60
End If
dSecond = dSecond - 1

End Sub
Where dSecond & dMinute are Private Integers in General Declarations. I set
dMinute to the value 10 and dSecond to 0 in Form_Load.
reply

To make a start-stop watch

Sat, 06/16/2007 - 04:59 Anonymous

I suggest a simple method to make a start-stop watch : Take the first exemple of this
toturial, look at for the variable mintCount:
at line mintCount = mintCount + 1
we rewrite : " mintCount = mintCount + tmrTest.Interval" .
Make a Textbox on the main Form (for exemple : with the name txtTime).
Then, the text of this Textbox will be set : txtTime.Text =
FormatNumeric(mintCount/1000,2)
'Format a numeric number with 2 numbers after '.'
'That give us : second.milisecond
But this solution has a problem: If we choose a small value of Interval of Timer (for ex:
100, 200), the elapsed time is displayed on the TextBox is incorrect because the
program takes a few moment to execute the syntax.
However, if we use a higher Interval value (for ex : 500), we can avoid this problem.
reply

Countdown?!

Tue, 01/22/2008 - 20:30 Anonymous

can you please teach me how to make a timer countdown...!!!


i really dont know how...
countdown timer as it will appear as this "10:00"
hope you'll reply as soon as possible...please!!!!
reply

pause nd reset options??

Mon, 05/28/2007 - 22:05 Anonymous

can anyone help me with getting the timer start stop nd reset.....as we do exactly with an
start stop watch????
reply

when you stop the timer


it is

Mon, 05/23/2011 - 09:15 Anonymous (not verified)

when you stop the timer it is already reset


reply

another example

Sun, 05/27/2007 - 11:40 Anonymous

i wish to know how to make an actuall timer, for a game... for example... the user is being
timed as to their efficiency in doing a test... (15 questions)...
i understand that i'll need 2 timers and a lable which desplays the time going up and
starting from 0 minuts... can u post something like that up?? thanks
reply

Post new comment


Your name:
Anonymous
E-mail:

The content of this field is kept private and will not be shown publicly.

Homepage:

Subject:

Comment: *

Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
Lines and paragraphs break automatically.
You can enable syntax highlighting of source code with the following tags: <code>,
<blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options


Word verification: *

(verify using audio)


Type the characters you see in the picture above; if you can't read them, submit the form and a new
image will be generated. Not case sensitive.

Preview

Unless otherwise noted, all content on this site and in the source samples is Copyrighted
2011 by the owner of vb6.us. All rights reserved - Contact Information

Das könnte Ihnen auch gefallen