Visual Basic Lesson Three – Random Integer

This is a very easy lesson in which we will learn how to generate a random integer.

Hey there, If you would like to check the two previous lessons here is a link for them:

1. http://computersight.com/programming/visual-basic-creating-a-basic-calculator/

2. http://computersight.com/programming/visual-basic-leson-two-creating-a-google-searcher/

 Today in this lesson I will show you how to generate a random ineger using visual basic it is a very easy task you do not need any visual basic skills to finish it. This could be very helpful in creating various software like a card game, random file opener (which will be covered later) , or random song player , etc. Here are the simple steps you will need to follow to have this awsome thing finished.

  1. Add 2 buttons.
  2. Add a timer.
  3. Add a textbox.
  4. Double click button1
  5. paste the following code; timer1.enabled = true
  6. Go back and double click button2
  7.  Paste the following code; timer1.enabled = false
  8. Go back and double click the timer
  9. Paste the following code

Dim ahmedehababouelnasr As Integer

ahmedehababouelnasr = ahmedehababouelnasr2.Next(1, 99999999)

TextBox1.Text = ahmedehababouelnasr

And you are done!!!

Dim ahmedehababouelnasr2 As New Random

Again, here are the two previous lessons here is a link for them:

1. http://computersight.com/programming/visual-basic-creating-a-basic-calculator/

2. http://computersight.com/programming/visual-basic-leson-two-creating-a-google-searcher/

Bye n cyo

09.10.02

A good read thanks for the share nice work!

09.10.02

A very useful lesson in basic. Thank you for sharing.
Monica.

09.10.02

welcome guys and thank you for your nice comments

09.10.02

Nice guidance. Thanks

09.10.02

Interesting article here
Well done!

09.10.02

a kind of information

comments powered by Disqus
Loading