473,320 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

timer and loop

hi guys,

im a complete noob.

basically im creating a program where i want a series of circles to appear on the screen each with a varied amount of delay.....so for example the first circle could appear after 1 second the second after .5 seconds and the third after 1.5 seconds

code<

Dim num As Integer

Private Sub cmdEnd_Click()
End

End Sub

Private Sub cmdStart_Click()

Dim x1 As Integer, x2 As Integer, y1 As Integer, y2 As Integer
Dim c1 As Integer, c2 As Integer, c3 As Integer, r As Integer
picOutput.Cls

Timer1.Interval = Int(Rnd * 2000)
Timer1.Enabled = True


End Sub

Private Sub Timer1_Timer()

num = num + 1

x1 = Int(Rnd * 140)
y1 = Int(Rnd * 140)
r = 10
c1 = Int(Rnd * 255)
c2 = Int(Rnd * 255)
c3 = Int(Rnd * 255)


picOutput.Scale (-100, 200)-(200, -100)
picOutput.FillStyle = 0
picOutput.PSet (x1, y1), RGB(c1, c2, c3)
picOutput.Circle (x1, y1), r, RGB(c1, c2, c3)
Timer1.Enabled = False

End Sub
code>
Oct 21 '06 #1
1 1850
albertw
267 100+
hi guys,

im a complete noob.

basically im creating a program where i want a series of circles to appear on the screen each with a varied amount of delay.....so for example the first circle could appear after 1 second the second after .5 seconds and the third after 1.5 seconds

code<

Dim num As Integer

Private Sub cmdEnd_Click()
End

End Sub

Private Sub cmdStart_Click()

Dim x1 As Integer, x2 As Integer, y1 As Integer, y2 As Integer
Dim c1 As Integer, c2 As Integer, c3 As Integer, r As Integer
picOutput.Cls

Timer1.Interval = Int(Rnd * 2000)
Timer1.Enabled = True


End Sub

Private Sub Timer1_Timer()

num = num + 1

x1 = Int(Rnd * 140)
y1 = Int(Rnd * 140)
r = 10
c1 = Int(Rnd * 255)
c2 = Int(Rnd * 255)
c3 = Int(Rnd * 255)


picOutput.Scale (-100, 200)-(200, -100)
picOutput.FillStyle = 0
picOutput.PSet (x1, y1), RGB(c1, c2, c3)
picOutput.Circle (x1, y1), r, RGB(c1, c2, c3)
Timer1.Enabled = False

End Sub
code>
this way you need to press the cmdStart button every time while you have timer disabled after drawing.
you may also include a new timer interval instead of timer1.enabled=false., where the program continues drawing circles.
Oct 22 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: RitaG | last post by:
Hi. I Have a VB.Net Windows Application that starts up using Sub Main. It's a program that runs in the background and checks something every minute. I use a Timer to accomplish this and it's...
8
by: Daniel P. | last post by:
I'm trying to set a timer that gets called every 3 seconds so I can update a field in the UI with the time elapsed since the process started. What am I doing wrong that timerDF_Tick does not get...
11
by: avivgur | last post by:
Hello, I have devised a console application that uses a System.Timers.Timer and its Elapsed event. The problem is that I want the program to continue to run so that each time the event is raised,...
3
by: Kenny | last post by:
I am running a windows service that takes actions based on a couple System.Threading.Timers. The intervals are usually short... based on the time of day, anywhere between 1 and 5 minutes. ...
4
by: hazz | last post by:
given namespace WindowsService1 { public class Service1 : System.ServiceProcess.ServiceBase......... private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { ArrayList...
14
by: Crirus | last post by:
This is more a logical problem than a VB. I have this situation: A timer that need to tick at each 10 minutes starting on minute 15 of curent hour. But I want to calculate the next tick...
6
by: Aart Nicolai | last post by:
Hi all, I have developed a vb.net console application which will run some code every seconds. To get this working I used a timer "System.Timers". When I start my console application it exits...
4
by: Lemune | last post by:
Hello everyone. I'm using vb 2005. I'm creating program that run as service on windows. And in my program I need to use timer, so I'm using timer object from component. I try my source code on...
4
by: grayaii | last post by:
Hi, I have a simple form that handles all its paint functionality like so: this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true); And the entry point to this...
2
by: John O'Flaherty | last post by:
Hello, I'm having trouble with the timer control in VB6. I have a form with a timer control and a command button, and this simple code: Dim TimeOut As Boolean Private Sub Form_Load()...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.