472,791 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Timed Random number in 2005 Express

i have been trying to set a amount of time a random number has


Expand|Select|Wrap|Line Numbers
  3.       TextBox6.Text = CStr(Int(Rnd() * 10))
  5. ' This variable will be the loop counter.
  6. Private counter As Integer
  8. Private Sub InitializeTimer()
  9.    ' Run this procedure in an appropriate event.
  10.    counter = 0
  11.    Timer1.Interval = 600
  12.    Timer1.Enabled = True
  13. End Sub
  15. Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  16.    If counter => 10 Then
  17.       ' Exit loop code.
  18.       Timer1.Enabled = False
  19.       counter = 0
  20.    Else
  21.       ' Run your procedure here.
  22.       ' Increment counter.
  23.       counter = counter + 1
  24.       TextBox6.Text = counter.ToString
  25.    End If
  26. End Sub

I can get the timer to run and the radom number to run but i cant seem to do both at the same time

I would like a timed random number generatered at a set amount of time
Feb 9 '08 #1
1 1035
why don't you

Code: ( text )

' This variable will be the loop counter.
Private counter As Integer

Private Sub InitializeTimer()
' Run this procedure in an appropriate event.
counter = 0
Timer1.Interval = 600
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If counter => 10 Then
' Exit loop code.
Timer1.Enabled = False
counter = 0
' Run your procedure here.
' Increment counter.
counter = counter + 1
TextBox5.Text = CStr(Int(Rnd() * 10))
TextBox6.Text = counter.ToString
End If
End Sub

you might want to use doevents, too
Feb 14 '08 #2

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

Similar topics

by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading...
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I have a basic question thats been niggling me, but I never found time to look at it before. If I have an enumeration such as this Fiend Enum TravelDirection North South East
by: sebnunes | last post by:
Hi all, I have a strange behavior with the ASP .NET 2.0 Admin tool. When I click on ASP.NET Configuration in VS 2005 the Administration intro page displays correctly but when I click on any...
by: Jimmy | last post by:
ill have a database with 1 table and 3 fields: ID FIRSTNAME LASTNAME (the ID field will be the auto incrementing index) there might be 10 records in the DB, there might be 10,000. i...
by: Pascal | last post by:
hello and soory for my english here is the query :"how to split a string in a random way" I try my first shot in vb 2005 express and would like to split a number in several pieces in a random way...
by: Juha Nieminen | last post by:
I'm trying to use a random number generator and rand() is just not up to the task (RAND_MAX is way too small). I searched in the help system and found the System::Random class which seems to be...
by: SammyB | last post by:
These are some "random" thoughts about generating random numbers in Visual Basic. Wikipedia will give a better introduction than I, see http://en.wikipedia.org/wiki/Random_number_generator. ...
by: Peter Oliphant | last post by:
I would like to be able to create a random number generator that produces evenly distributed random numbers up to given number. For example, I would like to pick a random number less than 100000,...
by: Masud | last post by:
hi, for a test i want to generate different random numbers between different ranges in a single loop. I tried to solve in the following way but it always profile same value. I am looking for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.