Page 8 - revision
P. 8
Orouba Language Schools Third Preparatory
Computer Department Second Term 2017/2018
Write the code to:
1) Declare a variable name “F_Name” for storing the value “Ahmed”
Dim F_Name As String = ”Ahmed”
2) Declare a constant name “A1” for storing the value 75.32
Const A1 As Single = 75.32
3) Declare a variable name “Date of birth” for storing the value 1/1/2000
Dim Date of birth As Date = #1/1/2000#
4) Declare a variable name “Mark” for storing the value 15
Dim Mark As Byte = 15
5) Declare the variable name “Gender”
Dim Gender As Boolean
6) Enter the value of variable “degree” Dim degree as single
in Textbox control then the
message “successful” displays in Degree= textbox1.text
the message box if the “degree” is
greater than or equal 50; otherwise If degree>=50 Then
display a message “unsuccessful”. Msgbox(“successful”)
7) Display even numbers in Else
descending order from 10 to 1 in a Msgbox(“unsuccessful”)
message box by using the For
statement and Do While..Loop End If
8) Display the numbers that can be Dim x as Byte Dim x as Byte=10
divided by 3 starting from 3 to 20 in
Textbox1 by using the For … Next For x = 10 To 1 Step -2 Do While x >1
statement.
Msgbox (x) Msgbox (x)
Next x x=x-2
Loop
Dim m as Integer
For m = 3 To 20 Step 3
Textbox1.text= Textbox1.text & m& vbcrlf
Next
9) Display the Odd number from 11 to Dim n as Byte Dim n as Byte =11
99 in Listbox1 by using For …Next
For n=11 To 99 Step 2 Do while n < = 99
and Do While ...Loop.
Listbox1.Items.Add(n) Listbox1.Items.Add(n)
Next N= n+2
10) Assign the value in Textbox1 to the variable Y: Loop
Textbox1.Text = Y
11) Set the cursor inside TextBox1:
TextBox1.Focus ( )
12) Empty TextBox1 :
TextBox1.Text = “”
13) Empty ListBox1 :
ListBox1.Items.Clear ( )
14) Add the value of variable X to the ListBox1 :
ListBox1.Items.Add (X)
Final Revision 8