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:
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.
- Add 2 buttons.
- Add a timer.
- Add a textbox.
- Double click button1
- paste the following code; timer1.enabled = true
- Go back and double click button2
- Paste the following code; timer1.enabled = false
- Go back and double click the timer
- 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:
Bye n cyo