Lesson 1.

Simple program


Start making a new startard EXE (EXE = Executable)

The form caption is Form1, we rename it to test from the properties window located at the right side.

At left side there is the toolbox. Find CommandButton and click it once. Then click on the form and by holding mouse left button choose size and let it go.

Change caption to Try.

Add a TextBox inside the form,go to properties and erase the Text1 from Text.

Now double-click the Try Button. You will see :  Private Sub Command1_Click()

                                                                                     End Sub

Now write inside :       num = Int(Rnd * 69) + 1

                                       Text1.Text = num

We should see that :                 Private Sub Command1_Click()

                                                      num = Int(Rnd * 69) + 1

                                                      Text1.Text = num

                                                      End Sub


We are done !!! Press F5 or Run Start from the upper toolbar.

Our program is running.   Just press the Try button,you get a random number,yes?

Press it several times,you get “whatever” numbers,right? Why is that?

Well let’s see the code we wrote.

num = Int(Rnd * 69) + 1  Rnd is the random number, (* 69) + 1  means from 0 to 70.

Pretty simple, isn’t it?