UNIT TITLE: EVENT DRIVEN PROGRAMMING
Assignment Two
This assignment focuses on the following
• Controlling program flow using if control structure and select case control structure
• Use of option buttons and checkboxes
Create a VB project and save it as assignment two – your name and in this project add the following forms
i. A form that reads in a student’s cat1, cat2 and final exam marks then computes the total and displays the total in a text box. It then displays a remark as “pass” in a textbox if the students total is greater than or equal to 40 otherwise it displays fail. Use the if control structure. ii. Add a text box grade to the above form and a command button with the caption/text as “Grade” that computes the grade when it is clicked. The grade is computed as follows
• Total greater than or equal to 80 – Grade “A”
• Total greater than or equal to 65 and less than 80 – grade “B”
• Total greater than or equal to 50 and less than 65 – grade “C”
• Total greater than or equal to 40 and less than 50 – grade “D”
• Total less than 40 – grade “F” iii. A form that gets two numbers from the user through text boxes. Displays four options using option buttons. The options include Add, Multiply, Divide and Subtract. The user should enter two numbers, select an option and when he clicks on a command button the appropriate result is displayed in a text box. Use select case control structure. iv. A form with one text box and three checkboxes captioned bold, hide, italic. When the bold button is checked the text in the textbox turns bold and when it is unchecked the bold is removed. The same applies to all buttons. Note that properties can be changed at run time e.g.
If CheckBox1.Checked = True Then TextBox1.Visible = False
End If
The above example checks if the control named checkbox1 is checked if it is then the textbox1 is hidden.
Note:
Take note of user interface design principles and vb controls