Skip to main content

XI IT Assignments - Controls: Events & Properties

Hello Programmers,
Run through this tutorial cum assignment to get a hang of various controls, their properties and the most used events associated with these controls. Try the following and send me the answers or the codes (zip all files - frm & vbp - and send) on the mail id: events@abhinav.ac.in

Form
This is the most basic control. You have already seen some events on this object.
  1. What is the sequence in which the events Activate, Load & Open occur? To find out, write a simple code for each of these events to display a msgbox saying that the event has occured. Now run the program. One by one the messages will popup showing you what happens and in which order.
  2. What does the KeyPress event do? To find out trap this event, i.e. write a small code at this event, say like - MsgBox "Hello". Now run the program and try pressing a key ...
  3. What do the MouseUp and MouseDown events do? Trap these events like described above and find out the difference between the two states of the mouse buttons - Down (pressed) and Up (released). Be sure to write different msgboxes (i.e. saying something different) for each event. Maybe you can also try the following - instead of msgboxes, print something different on the form for each event.
  4. How can you change the background of the form from within the code? At form_click write a code to change the property of the Form.BackColor property (mind the dot between Form and BackColor), i.e. set the value of Form.BackColor to something new. Run code and see
  5. What do these properties do - WindowState, Caption & ControlBox? To find out ... write a code at Form_Click which changes the value of these properties (one property at a time). To guess which values work, look at the property in the Property Sheet which pops up when you right click on the form and select "properties".
TextBox
  1. What does the PasswordChar property do? You can either write a code like the ones above to modify this property at run-time or set different values at design-time and then run the program to see what happens.
  2. How does the MultiLine property work? You know how to test a property by now ...
  3. How are the Enabled and Locked properties different? Try setting the values for each in turn and see what happens? Each property has two possible values, so you have to try out four combinations.
  4. What if you trap the Change event and run a msgbox when it occurs? You know how to trap events ... just write a code for that event of that object. In the code write a simple msgbox to say something.
  5. How do the GotFocus and LostFocus events work? Trap them and find out ... You can trap them at the same time as two different codes (one for TextBox_GotFocus and one for TextBox_LostFocus)

Comments

All Time Popular Posts

Annual Day 2023

 After a long hiatus due to covid we finally got most activities on track. The Annual Day function is always a big deal for everyone at Abhinav. It has been a tradition my mother started that the Annual Day will be not a Teacher-managed event, but a Student Initiative. Since when I was a teenager, I was part of this and today 10 years after she passed, I still strive to make it work as she would have. After some hesitation, we began working in early January. I wanted to use an outside choreographer just so that teachers will not be burdened. (They are already struggling with post-covid learning difficulties) But then, an outside guy could never do justice to the Abhinav style of doing things. We always keep in mind that the cultural program should be enjoyable to everyone in the audience and at the same time should display as many of the diverse talents that our students have, as possible.  It was a great relief that my G3 students came to the rescue. Almost all of std 9 and m...

Trapping events - IT assignment for Std XI

Perform these tasks on your PC and give yor answers as comments to this post or as an email to my ID - director@abhinav.ac.in . What is the sequence for the events given below and when do they occur for the given object? a) Textbox - Change, KeyPress, KeyDown, Validate b) Command button - Click, GotFocus, LostFocus, KeyPress c) Combo Box - Change, Click, DblClick, DropDown, Scroll Draw an equilateral triangle (should actually look like it) whose one vertex is the point at which the user clicks on the form. Make a simple calculator which has buttons for different numbers & operations (+, -, *, /, ^) and a box to display the result of each operation as well as each number being typed.

Expression Calculator in Java

Std X CA students: Here is another assignment to be finished before Thursday 24th Apr, 2014, 8 am. Reverse engineer the application I have posted at the FB group - Expression Caculator . i.e. 1. download the file and save in the root of c-drive 2. run it in command prompt using "java -jar c:\exprcalc.jar" 3. enter various expressions to compute like 2 + 3 = (then enter) 4. once you type '=' and a white space and enter, it displays the result. 5. You can take a long expression like 7.5562 / 7.889 + 5 - 12.67 = (then enter) 6. You can type another expression after the result for the previous is shown. 7. It also handles errors well. Figure out the code and paste your answers here as a comment. Hint: It uses a blank for loop ... i.e. for (;;) { here goes the code }to repeat taking many numbers one after the other.