Subscribe For Free Updates!

We'll not spam mate! We promise.

الأحد، 30 يونيو 2013

Explain the loop in Visual Basic



Explain the loop in Visual Basic
I will explain that, God willing, the easiest types because there is a lot a For to

General shape her
For I = a to b
Orders to check
Next i
  a is the first figure that begins of Atdh count
b is the last number and ends up counting

For example, we want to print the numbers from 1 to 10
For I = 1 to 10
Print I
Next I

The program will snapped the first value for I, a single and then bring it
It is the number one printing finds inter next I goes back to the top
To No. 10 and then stops

If we print even numbers from 0 to 20

We will add inter step step means If not we write one program considers

And not the code

For I = 0 to 20 step 2
Print I
Next I

The loop and arrays
The loop is often used in arrays and especially if the elements of the matrix
In large we do not Nstaitia that Tiger on all the elements of the matrix

So we use loop

For example, I have a matrix consisting of 20 items and I want to print

Will write the code 20 times for print, but use the loop

Let you have a matrix like this

Element value
1 10
2 23
3 28
4 69
5 220
6658
7 89.2
8 326.9
9 32
102 223



And I want to print these figures first we define the matrix in the general public

Dim a (10)

A Almtvovh name
10 the number of elements

Then we enter the matrix elements in the event lood or command button

A (1) = "10"
A (2) = "23"
A (3) = "28"
A (4) = "69"
A (5) = "220"
A (6) = "658"
A (7) = "89.2"
A (8) = "326.2"
A (9) = "32"
A (10) = "2223"


Now not only keeps ahead Printing using the loop
Venketb this code

For i = 1 To 10
Print a (i)
Next i

Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 التعليقات:

إرسال تعليق