(If … Then) Statement: This is the simplest control structure which ask the computer to perform a certain action specified by the VB expression if the condition is true. However, when the condition is false, no action will be performed. The general format for the (If - Then) statement is: If condition Then VB expression End If Example1: Design a form with two text boxes and two Command buttons. Write a code so when run project and click on command1 (Result) display the word “Pass” if the student degree equal or more than 50, and when click on Command2 clear the text boxes. Solution: Private Sub Command1_Click() If val(Text1.Text) >= 50 Then Text2.Text = "Pass" End If End Sub 2 Private Sub Command2_Click() (If … Then … else) Statement: The If – Then - Else statement allows the programmer to specify that a different actions to be performed when a certain action specified by the VB expression if the condition is True than when the condition is false, an alternative action will be executed. The general format for the (If - Then – Else) statement is: If condition Then VB expression Else VB expression End If Text1.Text = "" Text2.Text = "" End Sub Text1.Text = "" Text2.Text = "" End Sub
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم
|