Presentation is loading. Please wait.

Presentation is loading. Please wait.

Revision Exercise: Control Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________.

Similar presentations


Presentation on theme: "Revision Exercise: Control Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________."— Presentation transcript:

1 Revision Exercise: Control Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________ Which control will you use for user to choose the kinds of fruit he/she likes, e.g. Apple, Banana, Orange? ____________ Name ______________ No _____ Class _______ (PA)

2 Revision Exercise: Concatenation Write code to join the text string so that txtResult will look like as below? PeterChan txtFirstName txtLastName txtResult My Name is Peter Chan. txtResult txtResult.text = “My Name is ” Name ______________ No _____ Class _______ (PA)

3 Revision Exercise: Symbol Which symbol is used to enclose a text string in code, e.g. “Hello World” and then assign it to a textbox? ____________ Which symbol can be used to write a non-executable comment? ____________ Which symbol will you use to break a long statement into different lines? ____________ Name ______________ No _____ Class _______ (PA)

4 Revision Exercise: Code 1. Write code to assign “Peter” into a textbox? txtName Peter = txtName 2. Write code to end a program? 3. Write code to reset the insertion point in a textbox? Name ______________ No _____ Class _______ (PA)

5 Exercise n = 4, answ = “Y” Are the following conditions true or false? Not (n < 6) (answ = "Y") Or (answ = "y") (answ = "Y") And (answ = "y") Not(answ = "y") True/False Name ______________ No _____ Class _______ (PA)

6 Exercise Determine whether the following conditions are true or false. Let a = 2, b = 3 1.(5 – a) * b < 7 2.NOT (a < b) 3.(a * a < b) OR NOT (a * a < a) True/False Name ______________ No _____ Class _______ (PA)

7 Exercise Determine whether the following conditions are true or false. Let a = 2, b = 3 1.“Inspector” < “gadget” 2.a <> b 3.((a=b) OR NOT (b < a)) AND ((a < b) OR (b = a + 1)) True/False Name ______________ No _____ Class _______ (PA)

8 Exercise: Find the larger number (1) This application is used to find a bigger number. After you have entered 2 numbers into the first two textboxes and have clicked the button, the bigger number will then be displayed in the last textbox. In VS.NET 2003, which area should you double click and put the code inside? 1 3 2 4 6 5 Name ______________ No _____ Class _______ (PA)

9 In VS.NET 2003, which area should you put the code inside? 2 1 3 4 5 6 7 8 9 Line 4-123 Don’t change! Line 144 Line 3 Name ______________ No _____ Class _______ (PA)

10 Fill in the blanks: Hints: Label1, Label1.text, txtNum1, txtNum1.Text, txtNum2, txtNum2.Text, txtResult, txtResult.Text, num1, num2, largerNum, CInt, CDec, Interger, Double, Decimal, Date Dim num1, num2, largerNum As ____________ num1 = CDec(____________) num2 = CDec(txtNum2.Text) If num1 > num2 Then _________ = num1 Else largerNum = ______ End If txtResult.Text = _The larger number is " __ __________ Exercise: Find the larger number (3) txtNum1 txtNum2 txtResult Name ______________ No _____ Class _______ (PA)

11 Exercise: Determine what output will be displayed in the text box when the button is clicked. Private Sub btnDisplay_Click (…) Handles btnDisplay.Click Dim gpa As Double = 3.49 txtOutput.Clear() If gpa >=3.5 Then txtOutput.Text = “Good” End If txtOutput.Text = txtOutput.Text & “ Student” End Sub What is the output result of the text box? Name ______________ No _____ Class _______ (PA)

12 Compound Conditions If radMale.Checked = True And CInt(txtAge.Text) < 21 Then … ‘Will the program continue to run … End If Situation True/False radMale not checked txtAge greater than 21 radMale not checked, txtAge less than 21 radMale checked, txtAge 21 or greater radMale checked, txtAge less than 21 Name ______________ No _____ Class _______ (PA)

13 Compound Conditions If radJunior.Checked = True Or radSenior.Checked = True Then … ’Will the program continue to run … End If Situation True/False radJunior.Value=True radSenior.Value=True radJunior.Value=False, radSenior.Value=True radJunior.Value=True, radSenior.Value=False radJunior.Value=False, radSenior.Value=False Name ______________ No _____ Class _______ (PA)


Download ppt "Revision Exercise: Control Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________."

Similar presentations


Ads by Google