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.
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.
- 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.
- 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 ...
- 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.
- 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
- 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".
- 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.
- How does the MultiLine property work? You know how to test a property by now ...
- 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.
- 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.
- 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
Post a Comment