Conditional Repeating Very often we need to perform a task repeatedly in order to achieve our objective. This repetitive process is called looping in programming language. Visual Basic allows a procedure to be repeated many times until a condition is met. There are three kinds of loops in VISUAL BASIC, which are Do…. Loop , While… Wend and For…Next. Do….. Loop The structure of a Do Loop command can be written in four different formats as shown below: a) Do While condition Block of one or more VISUAL BASIC statements Loop b) Do Block of one or more VISUAL BASIC statements Loop While condition c) Do Until condition Block of one or more VISUAL BASIC statements Loop d) Do Block of one or more VISUAL BASIC statements Loop Until condition 2
Example-1 Private sub commond 1_click( ) Do while counter <10 counter =counter+1 Print Counter Loop End sub In the above example, the value of counter will increase by 1 after each loop and it will keep on adding until counter = 10. The values are displayed in the following figure . Example-2, Example-3 and Example-4 produce the same result as above.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم
|