




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The Document Covers full five unit of Visual basic Question and Answers.
Typology: Exams
1 / 148
This page cannot be seen from the preview
Don't miss anything!





























































































1. Write any four properties of command button. (Apr’16, Nov’15, Nov’13) a. Name: Name of the command button b. Caption: The text displayed on the form c. Visible: It determines whether the command button displayed on the screen or not. d. Enabled: Determines whether the button is responsive or not. 2. List any four standard controls in VB. Label, TextBox, CommandButton, CheckBox, OptionButton 3. Write any four properties used to control the appearance of a form. Form BackColor, Height, Width, FillColor 4. State the different data types in VB. (Nov’15, Nov’12) Byte, integer, long, single, double, currency, variant 5. List the various controls available in VB “Tool Box” Label, TextBox, CommandButton, CheckBox, OptionButton, PictureBox, ComboBox, ListBox, ImageBox etc. 6. Define FORM. A form is a container in visual basic IDE which is used to place various controls based on the application requirements. Also it is a blank window in visual basic contains the grid of dots. 7. What is a variable? A variable is a name given to a memory location where a data value will be stored. The value of a variable may be changed at any time during program execution.
15. What is IDE? An integrated development environment (IDE), also known as integrated design environment is a software suite that consolidates the basic tools developers needs to write and test software. Typically, an IDE contains a code editor, a compiler or interpreter and a debugger. 16. Write a note on properties window. Properties window displays the list of design time properties for the selected objects and their current settings. A property is a characteristic of an object such as name, size caption. 17. What is the toolbox?(Apr’12, Apr’11) A toolbox contains a set of tools that are used at design time to place controls on a form. It contains more than 20 controls. 18. How to declare a variable in VB? A variable can be declared with the help of “Dim” statement. Syntax: Dim <variable_name> as
1. Explain the data types supported by VB? Explain with example.(Apr’16, Apr’12, Nov’11) There are five categories of data types of VB6: a) Integer b) String c) Date d) Boolean e) Variant i. Integer Data Type But these Data type categories are divided into more sub data types. ii. String Data type: Array of characters can be stored by using a string data type.. A string variable can be of two types, one is fixed length string variable and other is variable length variable. This data type is useful, when we collect the data from the text box. iii. Date Data Type: The date data type is used to store date and time values. Example: Dim DateOfBirth As Date Dim Kickoff Time As Date iv. Boolean Data Type: Boolean data types hold either a true value or false value. These are not stored as numeric value and cannot be used as such. Values are internally stored as 0(false) and any nonzero value for representing true value. Byte Store integer values in the range of 0 - 255 Integer Store integer values in the range of (-32,768) - (+ 32,767) Long Store integer values in the range of (- 2,147,483,468) - (+ 2,147,483,468) Single Store floating point value in the range of (-3.4x10-38) - (+ 3.4x1038) Double Store large floating value which exceeding the single data type value Currency store monetary values. It supports 4 digits to the right of decimal point and 15 digits to the left
CheckBox: This control is a little square with an optional checkmark, which acts as a toggle. The CheckBox control lets the user to select or unselect an option. When the checkbox is checked, its value is set to 1 and when it is unchecked the value is set to 0. Every time the user clicks it, it changes the state. MessageBox: Message boxes display information in a dialog box superimposed on the form.They wait for the user to choose a button before returning to the application. Message boxes can hold maximum of 1024 characters. Syntax: Msgbox Message, TypeofBox, TitleofBox
4. How to customize a FORM? (Nov’14, Apr’14) The Form Window is central to developing Visual Basic applications. It is where we draw our application. The Toolbox is the selection menu for controls used in our application. Altering a Form: To change the position of a form at run time, a) Move the cursor to the form Layout Window. b) Drag the form to the position where we want to appear at runtime. The Project Window displays a list of all forms and modules making up our application. Common Form properties: i. Caption: This property sets the title of the form. ii. Name: This property is used in the code to identify the object (control). iii. Appearance: It is used to determine how the form looks on the screen iv. BorderStyle: It determines border style of the form.
v. Enabled: It determines whether an object can respond to user generated events vi. Font: This property retrieves windows font dialog box and used to set font for the information will be displayed on the form. vii. Control Box: This property determines whether the form contain control menu box at runtime which is used to minimize, maximize or close the form. The scale properties of the form are used to position the object or text in a form accurately. It has 5 scale properties. They are: ScaleMode, ScaleWidth, ScaleHeight, ScaleLeft, ScaleTop.
5. Explain the techniques to creating controls of a form.(NOV’12, NOV’14) There are three ways to creating controls on a form. They are: i. Double clicking the control icon in the toolbox. ii. Click the required control in toolbox and move the mouse pointer to the form, and draw the control. iii. Select the control, hold the mouse button down and drag the mouse to create the object. Resizing the Existing control: i. Use the properties window to adjust the width and height properties (OR) ii. Use the sizing handles (i.e) corner of the control Moving an existing control: a. Move the pointer anywhere inside the control click the left mouse button until the control is at location and the release the button. b. Select the control, use CTRL + Arrow key to move the control. c. Directly adjust the left and top properties in the properties window. 6. Discuss the Message Boxes in VB with examples. Message boxes display information in a dialog box superimposed on a form. They wait for the user to choose a button before returning to the application Message boxes are used for displaying short messages. It can hold maximum of 1024 characters.
Properties: Stretch It determines the whether the image control adjusts to fit the picture or the picture adjusts to fit the control. Its value is either true or false. True – The graphic resize to fit the control. False – (Default) The control resizes to fit the graphic. Picture Returns or sets a graphic to be displayed in a control. For the OLE container control, not available at design time and read-only at runtime. BorderStyle The borderstyle property for an image control has only two possible values. 0 - >No border 1 - > Fixed Single border Some of the important events related to image control are: Click, OLEDragDrop, OLEDragOver, MouseUp, MouseDown, MouseMove etc.
8. What are command Buttons? Explain the properties of command buttons. A command button is also known as push button. It is designed to respond to the user, when he clicked; it invokes a command that has been written into its Click event procedure. Most Visual Basic applications have command buttons that allow the user to simply click them to perform actions.More than 30 properties for a command button. Some of them are explained below:
To view the edit toolbar in Visual Basic application, go to view ToolbarsEdit. It contains the following tools. i. List properties/Methods(Ctrl+J) ii. List Constants (Ctrl+shift+J) iii. QuickInfo(Ctrl+I) iv. ParameterInfo(Ctrl+Shify+I) v. Complete word(Ctrl+spacebar) vi. Indent (Tab) vii. Outdent (Shift+Tab) viii. Toggle Breakpoint (F9) ix. Comment Block List properties/Methods (Ctrl+J) Displays a pop-up list box with the properties and methods for the object preceding the period. List Constants (Ctrl+shift+J) Displays a pop-up list box with the valid constants. QuickInfo (Ctrl+I) Provides the syntax for procedure or method. ParameterInfo (Ctrl+Shify+I) It provides the parameter list or argument list of the current procedure (or) function. Complete word (Ctrl+spacebar) Completes the keyword or object. Indent (Tab) It moves the currently selected text or the cursor to move forward to one TAB position. Outdent ( Shift+Tab) It moves the currently selected text or the cursor to move backward to one TAB position. Toggle Breakpoint (F9) It is used for debugging. Comment Block: Used to make the block of statements as non executable.
1. Explain the components of IDE. OR Explain about IDE in detail. IDE means Integrated Development Environment. The visual basic IDE is provided when the Visual Basic Application is launched is as shown below. Applications in VB are developed in the Integrated Development Environment. Following are the components of IDE: i. Menu Bar ii. Tools box window iii. Form window iv. Properties window v. Project explorer window vi. Code editor window vii. Form layout window viii. Object browser ix. Context menus x. Standard toolbar
Menu bar is used to perform various tasks It is viewed under the title bar. Each option on the menu bar has its own drop-down list. Access keys and shortcut keys are provided File Edit View Project Format Debug Run Query Diagram Tools Add- ins Help TOOLBOX WINDOW Toolbar contains a set of tools that are used at design time to place controls on a form. Using these controls, an interface between user and the application can be created. It contains more than 20 controls. FORM WINDOW: Forms are containers for controls. User interacts with the controls on a form to obtain the desired result. User can create and view controls on a form. PROPERTIES WINDOW: Properties window displays the list of design time properties for the selected objects and their current settings. A property is a characteristic of an object such as size , caption, height, width, etc. To view the properties window
(iii) View Selection Button->User can either view a single procedure or all the procedures in a module at one time. Shortcut Key is F7. FORM LAYOUT WINDOW: The form layout window decides in which position the form will be displayed at runtime. It allows the user to visually position the forms at design time. OBJECT BROWSER It displays the list of objects that can be used in the project. It also displays classes, properties, methods, events and constants in the current project. CONTEXT MENU: Context menu contains frequently used commands. To open a context menu, click the right mouse button on the object or press shift+F10. STANDARD TOOLBAR: The standard toolbar contains buttons that are shortcut to some commonly used items. Some of them are open project, save project, cut, copy, paste, etc.
2. Explain the various form properties. The common form properties are: Name Appearance Border style Caption Control box Enabled Font Height, width Icon
Left, top Mouse pointer, mouse icon Startup position Visible Window state Name: It is used to specify a name for the form. This property is used only in code. It is used to identify an object. Default value is “Form1”. Appearance: It is used to determine how the form looks on the screen. It has two values. 1 3D(Default) 0 Flat BorderStyle: It determines the border style of the form. It has six values. They are:
ScaleMode: It allows us to change the units used in form’s internal coordinate system. It has seven values. Its default value is 1-twips. ScaleWidth, ScaleHeight: These properties are used to set custom scale for the height and width of the form. ScaleLeft, ScaleTop: These properties are used to describe the values of left and top corner of the form.
3. Explain the various data types supported in VB. Visual basic provides several data types that are used to represent different types of values. The data types are divided into two categories. They are: 1. Fundamental data types 2. User defined data types. Fundamental Data Types: a) Integer b) String c) Date d) Boolean e) Variant i. Integer Data Type But these Data type categories are divided into more sub data types. ii. String Data type: Array of characters can be stored by using a string data type. A string variable can be of two types, one is fixed length string variable and other is variable length variable. This data type is useful, when we collect the data from the text box. Byte Store integer values in the range of 0 - 255 Integer Store integer values in the range of (-32,768) - (+ 32,767) Long Store integer values in the range of (- 2,147,483,468) - (+ 2,147,483,468) Single Store floating point value in the range of (-3.4x10-38) - (+ 3.4x1038) Double Store large floating value which exceeding the single data type value Currency store monetary values. It supports 4 digits to the right of decimal point and 15 digits to the left
iii. Date Data Type: The date data type is used to store date and time values. Example: Dim DateOfBirth As Date Dim Kickoff Time As Date iv. Boolean Data Type: Boolean data types hold either a true value or false value. These are not stored as numeric value and cannot be used as such. Values are internally stored as 0(false) and any nonzero value for representing true value. v. Variant Data Type This data type allows the user to store any type of data and is the default type in VB. If a variable is declared as variant, then it will have the ability to store ant type of values. When any value is assigned to a variant variable, it can automatically adjust the data type to the corresponding value. User defined data types: The user can create their own data types. Some of the user defined types are: i. Records ii. Enumerated data types. Records: A record is a mixed type variable. It may contain different kinds of data types. Syntax: Type data_type Variable End type Example: Type student Rollno as Integer Sname as String DOB as data End type To declare a variable of this type student is,