Monday, June 22, 2009

VB Randomize

Have you encountered a problem when it comes to randomization of numbers in Visual Basic?
For example you created a VB program that display 10 randomize numbers (1-10). When you run your program you thought it is working well. Example


However, the problem is when you run the program again, the program always output the same 10 random numbers as shown above. Every time you run your program, the random values are all the same. To solve this problem, try adding the code "Randomize" just after the form load. You only need to do this once. This way, each time you run your program, new random numbers are being generated. I hope it helps you in your VB programming...

No comments:

Post a Comment