1 / 13

Revision Exercise: Control

Revision Exercise: Control. Name ______________ No _____ Class _______ (PA). Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________

harken
Download Presentation

Revision Exercise: Control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Revision Exercise: Control Name ______________ No _____ Class _______ (PA) 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? ____________

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

  3. Revision Exercise: Symbol Name ______________ No _____ Class _______ (PA) 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? ____________

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

  5. Name ______________ No _____ Class _______ (PA) 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

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

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

  8. Name ______________ No _____ Class _______ (PA) 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 2 3 4 6 5

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

  10. Name ______________ No _____ Class _______ (PA) Exercise: Find the larger number (3) 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 " __ __________ txtNum1 txtNum2 txtResult

  11. Name ______________ No _____ Class _______ (PA) 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?

  12. Name ______________ No _____ Class _______ (PA) 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

  13. Name ______________ No _____ Class _______ (PA) 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

More Related