VB-41-50

Embed Size (px)

Citation preview

  • 7/30/2019 VB-41-50

    1/5

    Q41. What is MDI? What are the advantages of MDI forms and itsfeatures?

    The Multiple Document Interface (MDI) was designed to simplify the exchange ofinformation among documents, all under the same roof. With the mainapplication, we can maintain multiple open windows, but not multiple copies of

    the application. Data exchange is easier when we can view and compare manydocuments simultaneously. Multiple Word is a typical example.

    The main Form, or MDI Form, isn't duplicated, but it acts as a container for all thewindows, and it is called the parent window. The windows in which the individualdocuments are displayed are called Child windows.

    At run time, an MDI form and all of its child forms take on special characteristics:

    All child forms are displayed within the MDI form's workspace. The user canmove and size child forms like any other form; however, they are restricted tothis workspace.

    When a child form is minimized, its icon appears on the MDI form instead of thetaskbar. When the MDI form is minimized, the MDI form and all of its child formsare represented by a single icon. When the MDI form is restored, the MDI formand all the child forms are displayed in the same state they were in before beingminimized.

    When a child form is maximized, its caption is combined with the caption of theMDI form and is displayed in the MDI form's title bar (see Figure 6.6).

    By setting the AutoShowChildren property, we can display child formsautomatically when forms are loaded (True), or load child forms as hidden

    (False).

    The active child form's menus (if any) are displayed on the MDI form's menubar, not on the child form.

    Advantages of MDI:

    MDI applications can often handle multiple documents more readily than SDIprograms. For example, many MDI text editors allow the user to open multipletext files side by side in the same window, making it easy to compare and lookup information from a second document while working on the first.

    MDI applications tend to perform more quickly than SDI programs, since only one

    version of the application is loaded into memory.

    Uses-> MDI applications can be used for a variety of purposes - for example,working on one document while referring to another document, viewing differentpresentations of the same information, viewing multiple Web sites at the sametime, and any task that requires multiple reference points and work areas at thesame time

    State what happens to parent form in the following situation:

    Child form is activated.:- Then the MDI parent form will contain the child formand menu of them will be merged and appear in a single menu of the MDI parent

    form.

  • 7/30/2019 VB-41-50

    2/5

    Child form is minimized:- Then that child form will not appear in the desktoptoolbar rather it will appear in the bottom left corner of MDI parent form will beavailable to give space for other MDI child form.

    Child form is maximized:- It will occupy the whole space of a MDI parent form asif it is the only form available with menu.

    Q42. What is Seek Method? Which type of record set is available in this?

    The seek method of Record Set object can instantly locate a record in a tablebased on the value of an index field. The seek method is extremely fast becauseit uses the index of a table, and in effect, locates an item in a sorted list. Theseek method has the following syntax: Seek operator, key

    The operator argument is one of the following relational operators:

    = (equal) > (greater than)

    < (less than) >= (greater or equal)

    only table type record set support the Seek method.

    Q43. What is default and cancel button? How can we set them.

    Default and Cancel buttons are command buttons which are used to initiateactions usually by clicking on it. The Caption property determines the text todisplay on the face of the button. The Default property, if set to true, meansthat the button will be activated (same as Clicked) if the key is hitanywhere in the form. IfCancel is set to True, the button will be activated fromanywhere in the form by the key.

    Q44. What is meant by module? Explain its type.

    Modules are building blocks of a project. A module is a collection of procedures,functions and event handlers. There are three kind of modules.

    1) Form module: Form modules are the foundation of most visual basicapplications. They have the file name .frm extension. They containprocedures that handle events and general procedures and form leveldeclarations of variables, constants, types and external procedures. Thedeclaration in the form module are private by default.

    2) Class modules: Class modules are the foundation of object oriented

    programming in visual basic. They have the name .cls extension. We canwrite code in class modules to create new objects. These new objects can

  • 7/30/2019 VB-41-50

    3/5

    include their own customised properties and methods. We need to writecode for a class in a class module. We can then create objects of this classin other modules.

    3) Standard module: Standard modules are containers for procedures anddeclarations accessed by other modules within the application. Standard

    modules have the file name .bas extension. They can contain global ormodule level declarations of variables, constants, types, externalprocedures and global procedures.

    Q45. Compare Class module and Standard module.

    Class modules:

    1) Public variables in a class module can only be accessed if we have anobject variable containing a reference to a particular instance of a class.

    2) Class modules are an implementation of object oriented programming.

    3) All the objects have their own copies of member data.

    Standard modules:

    1) Variables declared public in a standard module are visible fromanywhere in the project.

    2) Standard modules are an implementation of procedural language.

    3) Only one copy of global variable exists.

    Q46. Differentiate between Input Box and MSG Box?

    We can use msgbox for display the message and getting input from user like VByes/no method, but inputbox only for input. For msgbox we can't set the x, ymargin, but in the input box we can set.

    Q47. Differentiate between picture box and image box.

    i) The image in image box is stretchable but in picture box no stretchable.ii) we can access only bitmap files in the Image box but in picture box we canaccess both bitmap & JPEG files.iii) Picture box control takes up more memory and Image box control takes upless memory.

    Q47(a) What do we mean by properties, methods and events of anobject.

    A property is an attribute of an object that defines one of the object'scharacteristics, such as size, colour, or screen location, or an aspect of its

  • 7/30/2019 VB-41-50

    4/5

    behaviour, such as whether it is enabled or visible. To change the characteristicsof an object, we change the values of its corresponding properties.

    A method is an action that an object can perform. For example, Add is a methodof the Combo Box object, because it adds a new entry to a combo box.

    An event is an action recognized by an object, such as clicking the mouse orpressing a key, and for which we can write code to respond. Events can occur asa result of a user action or program code, or they can be triggered by thesystem.

    Q48. What is the relationship of properties, method and events?

    Although properties, methods, and events do different things, they're ofteninterrelated. For example, if we move a control with the Move method (mostlikely in response to an event), one or more of the control's position properties

    (Top, Height, Left, and Width) will change as a result. Because the control's sizehas changed, the Resize event occurs. This interdependence means that we cansometimes accomplish the same task multiple ways in our code by manipulatingobject properties or methods.

    Q49. Describe briefly all the file controls.

    Three of the controls on the ToolBox that let us access the computer's file

    system are DriveListBox, DirListBox and FileListBox controls, which are the basicblocks for building dialog boxes that display the host computer's file system.Using these controls, user can traverse the host computer's file system, locateany folder or files on any hard disk, even on network drives. The file controls areindependent of one another, and each can exist on it's own, but they are rarelyused separately.

    DriveListBox : Displays the names of the drives within andconnected to the PC. The basic property of this control is the driveproperty, which set the drive to be initially selected in the control orreturns the user's selection.

    DirListBox : Displays the folders of current Drive. The basic

    property of this control is the Path property, which is the name ofthe folder whose sub folders are displayed in the control.

    FileListBox : Displays the files of the current folder. The basicproperty of this control is also called Path, and it's the path name ofthe folder whose files are displayed.

    Q50. Write syntax for loading, unloading, showing and hiding form.

  • 7/30/2019 VB-41-50

    5/5

    (A) Use the Load statement to load a form into memory without making it visibleyet. The Load statement will take only one argument: the name of the object tobe loaded. Take a look at the following code:

    Load Form1

    (B) When an individual form is no longer required, we can unload it frommemory. This will release the graphic components from memory.

    The following code unloads the form Form1:

    Unload Form1The Unload statement accepts a valid object name.

    (C) If the form is to be directly shown to the user, only the Show method isrequired. The loading of the Form object will take place automatically.

    The following line of code is required to both load the form and have it displayed:

    Form1.Show

    (D) If the form is no longer required to be on-screen, it can be removed fromdisplay by just using the Hide method. This keeps the form loaded but removes itfrom display. The following code demonstrates this:

    Form1.Hide