You are on page 1of 45

1

Qn. What is an Array? How do we create an Array in VB Program? Also write the syntax for creating a Multidimensional Array & Dynamic Array with suitable example.
Ans. Array is a linear collection of same type variable which allocates contiguous memory in the primary memory RAM. Alternately, we can say that Array is a common name shared by various variable of same type which allocates linear contiguous memory in the primary memory RAM. The main importance of array is to handle huge number of variables of same type very easily & efficiently by using index or, subscript of array blocks. It is also possible to declare huge number of same type variable using a single statement. Since, array allocates contiguous memory in the primary memory RAM. So, the access time of array variable is minimum. Consequently, the processing speed of program will be very fast. In Visual Basic, array is declared using the Dim keyword and the Redim keyword according with the name of the array & appropriate size.

The general syntax of array declaration in visual basic isDim ArrayName(Size) as DataType The ArrayName is any legal identifier allowed in visual basic that should be start with an alphabet and can be up to 256 characters. The special symbols Underscore (_) and Dollar($) can be allowed in identifier name. The size can be any positive integer number greater than zero(0) & can be any extend. The DataType can be any type allowed in visual basic. It may be any standard datatype like- int, double, single etc. or, it may be any control array as array of command button, array of listbox, array of textbox etc. By default, the index number of array blocks starting from 0 can be up to the size. A single block is represented using the arrayname and appropriate index within pair of parenthesis. So, array is also called Index Variable or, Subscripted Variable. For exampleDim A(5) as Integer The above declaration declares an array A of integer type asA 0 1 2 3 4 5

2

User also can specify own index range at the time of declaration of array. The general syntax to specify range of index in visual

basic asDim ArrayName (Starting Index to Ending Index) as DataType The starting index can be any positive integer less than the ending index. The ending index must be any integer number greater than the starting index. For exampleDim A (5 to 10) as Integer The above declaration declares an array as5 6 7 8 9 10 A User can also declare multidimensional array in visual basic by specifying number of rows and columns. It is possible to declare TwoDimensional, Three-Dimensional or, more dimensional array in visual basic. In visual basic, generally no upper limit of dimension is present but practically maximum 256 dimension can be implemented. In visual basic

Two-Dimensional array can be declared asDim ArrayName(Number of Rows, Number of Columns) as DataType The number of rows must be any positive integer number greater than zero & number of columns also must be a positive integer number greater than zero. For exampleDim A(5,4) as Integer The above declaration declares a 2D array asA 00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33 40 41 42 43 It is also possible to specify index range in 2D array. For exampleDim A(2 to 4,6 to 9) as Integer

3

The above declaration declares a 2D array of integer type asA 26 27 28 29 36 37 38 39 46 47 48 49 All the above array allocates their memory statically before execution and automatically initialized by their respective 0 value. User can also create array dynamically in visual basic. It is also possible to create single dimensional as well as multidimensional array dynamically in visual basic using the REDIM keyword. Using REDIM keyword an existing array can be increased in size by keeping the existing values unchanged by applying the keyword preserve. If the preserve keyword is not present then the existing value of an existing array will be deleted and initialized by zero.

In visual basic, single dimensional array can be created dynamically using the following syntaxRedim ArrayName (Size) as DataType For exampleDim N as Integer N=CInt (Inputbox(“Enter Size :”)) Redim A(N) as Integer In the above example user supply the size at the time of execution. After that, the array is created at the time of execution. This type of array is called Dynamic Array. The array will automatically initialized with their respective zero values.

It is also possible to create multidimensional array dynamically asDim R as Integer Dim C as Integer R=CInt (Inputbox(“Enter Rows :”)) C=CInt (Inputbox(“Enter Columns :”)) Redim A (R,C) as Integer

4

In the above example row and column value is inputted at the time of execution and the 2D array A is created using the (R+1) rows & (C+1) columns and all the blocks are of integer type. It is also possible to increase or, decrease the size of an existing array by preserving the existing values dynamically at the time of execution. For exampleDim A(10) as Integer Redim Preserve A(20) In the above example an integer type array A is created of 10 blocks and handled using appropriate statements. The last statement increase the size of the existing array A from 10 blocks to 20 blocks by unchanging the existing value. The same process can be applied on multidimensional array asDim A(4,5) as Integer Redim Preserve A(6,7) In the above example an integer type 2d array A of 4 row and 5 columns are created and handled by appropriate statements. The last statement reallocate memory for the same array by using new rows 7 & new columns 8 and preserve the existing values. The Redim keyword always allocates new memory and copies the existing array in new memory.

Qn.What is Visual Basic IDE? What are the components of Visual Basic IDE? Describe all the components briefly.
Ans. The abbreviated form of IDE is Integrated Development Environment. Integrated represents the added form of different components to form a proper system. The Visual Basic IDE is the development environment to develop any type of Visual Basic Application. In Visual Basic an IDE is present in which different independent components are present to develop

All types of options are present under appropriate menu in the form of menu item. 3. 10. 2.5 application as the requirement of the user. using mouse or. All the components are present in the IDE as integrated (added) form. 8. Title Bar Standard Menu Bar * Standard Toolbar * Form Design Window * Project Explorer Window * Properties Window * Toolbox * Code Window Object Browser Window Form Layout Window Immediate Window Title Bar The Title Bar is the top most horizontal line present in the VB IDE. Generally. 5. 7. 9. using standard shortcuts. In VB whole program is present under a project which contains all the forms as well as the internal coding system of application. A single project can contain more than one forms as the requirement of the application. In Visual Basic IDE the following components are present:1. the menu bar contains the following popular menus- . 6. 11. Standard Menu Bar The second horizontal line from the top is called Standard Menu Bar which contains standard menu to design as well as execute the application. User can use appropriate menu item present under menus or. 4. The menus present in the standard menu bar are the group name of a specific group of menu item. The Title Bar contains the project name which is under development and the form name which is currently active in the under development application.

otherwise the buttons are invisible. Run. exit option etc. Form-Design Window.User can combine list of radio buttons under a frame. print option. Window etc. Query. Indent etc. Toolbar etc. Paste. Form-Layout Window. For example. Toolbox. It is also possible to create . The Format menu is used to provide vertical and horizontal spacing of characters as well as same height and width of the components of the application. For example.exe file using the make . AddIns. The frame should be in the back of the radio buttons. Tools. The Project menu is used to add new forms as well as new modules in the current application. User can open the code window. The order of viewing of components is set using the order menu item present in the Format menu. It is also possible to set order of components in respect of viewing the components. It is also possible to add new controls in the toolbox using the components menu item present in the project menu. View. The Edit menu is generally used to provide appropriate format on the components present in the current application by using Cut. . Immediate Window.exe menu item present under file menu. Find. remove project option.6 File. Delete. Remove. User can remove existing form from the current application as the requirement of the user. Object Browser Window. The View menu is used to activate or. This menu also contains form saving option. Delete Table from Database.User can link a textbox with a table column to view content of the columns sequentially. User can also set a reference with a table columns to appropriate object present in the application. It is also possible to open existing project using open project menu item. Project. deactivate the different components present in the VB IDE. Replace. The File menu is used to create new project as well as save a new project. User can also view the tables present in the current application as well as provide appropriate properties to the fields present in the table. This menu also contains Undo and Redo option. Copy. It is also possible to open appropriate form using the object option present under view menu. Diagram. Format. Edit. Properties Window.

The start menu item is used to start execution of a Visual Basic Application. The Window menu is responsible to arrange more than one forms horizontally.7 The Run menu is responsible to execute an application. The horizontally and vertically menu item is . The query menu is responsible to retrieve appropriate information from the database and view the retrieved information on the forms. Informics etc. The Tools menu is responsible to add new procedure or remove existing procedure present in the code window. cascade. User can activate this menu item by pressing Ctrl+F5. Generally. Such as. It is also possible to create new table in the database according to the requirement of the user and automatically connect the database with the application as the requirement of the user. Visual Basic is used as a front-end tool to accept data values and viewing information as the requirement of the user. Oracle.MS-access. menus and menu items using the Menu Editor menu item present in the Tools menu. The form is automatically designed according to the number of fields present in the database. The DBMS provide high security to the data values present in the database. The start with full compile menu item is also used to execute a Visual Basic Application after full compilation of the application but the previous one does not compile the whole application before execution. It is also possible to create own menu bar. It is also possible to restart the execution by selecting restart or. It is also possible to format code window by clicking the options menu item and selecting editor format. Access or. SQL Server. Sybase. vertically. SQL Server or. end menu item present in the Run menu. User can add new records and can view existing records using the application. It is also possible to start execution by pressing the key F5. The Add-Ins menu is responsible to connect database visually with the current application. All the inputted information are stored by the VB in back-end DBMS. any other DBMS present in the system and connected with the application. The Query menu is responsible to execute SQL(Structured Query Language) statements to retrieve information from the database present in the Oracle or.

menu-items as the choice of the user. no overlapping is present. Standard Toolbar is the easy way to perform appropriate action on the application without searching the menu item present under menu.exe project symbol is used to create new application as the requirement of the user. copy. The menu designer tool is used to design user-defined menu bar. start execution. The open project tool is used to open existing project which are currently present in the system. The add form symbol is used to add new form in the current application. cut. The project explorer tool is used to re-display the project explorer component of Visual Basic IDE in the current application. copy of the selected text and insert the selected text at appropriate position as the choice of the user. Standard Toolbar contains symbolic representation which are popularly used in VB application development and present under different menus. Tiled horizontally arrangement arranges row-wise form & tiled vertically arrangement arranges column-wise form. paste. The save project tool is used to save the current application under a particular name supplied by the user. Standard toolbar contains symbolic representation of new project. stop etc. redo. visual component manager etc. properties.project explorer. form-layout. Paste tools is used to implement cut. Standard Toolbar Standard Toolbar is the third horizontal line from the top of VB IDE.0) up to the size which are currently selected on the current application. object browser window. menu editor. The start tool is used to start the execution of a Visual Basic Application. The standard . This toolbar also contains other components of the IDE. The Tiled arrangement is those type of arrangement in which one form is present besides the another form. The form-layout tool is . The cascade arrangement arranges the forms one upon another but the existence of previous form is viewed partially. toolbox. It is also possible to Off & On the properties window of a selected component of Visual Basic Application. Visual Basic also provide facility to add shortcut with the menu items as the choice of the user. only by clicking on appropriate symbol. undo. Copy. Such as. The toolbar also contains the co-ordinates of the form starting from (0. save project. The Cut. open project. User can add any number of form as the requirement of the user. add form.8 based on tiled arrangement. Generally.

. It is also possible to add components in the form using appropriate code written in the code window. When the number of forms are large then user can display appropriate form by double-clicking on the form name under the Project Explorer Window. User can also add components by clicking on component menu bar present under project menu or.9 used to display this component in Visual Basic Application. Project Explorer Window The Project Explorer Window shows the hierarchical display of the application and the forms. In real application the inputted data of Visual Basic program is generally stored in the back-end database present in MS-access. Visual Basic is used as a front end application tools for real life application. any other DBMS present in the system. The form-designer window can be designed externally at the time of development of the application using the toolbox. The toolbox tool is used to again display the toolbox in the application at the time of development. Oracle. This window show the project name which is under development. This window also shows the number of forms and name of forms currently present in the application. SQL server or. That means the only use of visual basic is to provide appropriate interface to the user to interact with the application. The form-designer window is the place where the application interface is created by the user with the help of toolbox. Generally. The object browser tools is used to open the object browser window to see the methods. Form-Design Window The Form Designer Window is used to design appropriate interface required for the application. object. by pressing Ctrl+T & select appropriate component as the requirement of the user. events and fields present in a selected class or. The form is the main container to contain the controls supplied from the toolbox to interface the application data stored in the back-end DBMS. right clicking on toolbox or.

The 3rd tool is used to off the previous two tools action. The 2nd tool display the forms present in the current application. image box. User can change the properties values of the properties by selecting the property and supplying new value using keyboard or. command button. Properties Window The Properties Window displays the field name and their current value of the selected object on the form-design window in two-column format. The radio button is used to select from a group of buttons to take appropriate action according to the state of radio button. control in the application. The text box is used to take input values from keyboard and all the values are treated as a string. The label is basically used to display message as a label which is displayed permanently on the application. combobox. label. scroll bars. Generally. The command button is used to take action on the application by clicking on the button by mouse. To form a group of radio buttons all the buttons are positioned on a frame. checkboxes are used to check conditions as the requirement of the user but radio button can check only single condition. drive list box. timer. Generally. directory list box. The properties windows is used to navigate all the properties (identifying properties) present in the selected object or. the properties window displays properties alphabetically. shapes. The 1st tool is used to display the code window for the current application. listbox. picture box. More than one checkbox can be selected as the choice of the user. The checkbox also has two states True or. ToolBox The toolbox is the most important component of Visual Basic IDE. More than one radio button cannot be selected at a time of a group. It is also possible to display categorisely. The toolbar is present in the left side of the form-design window and contains popular controls for Visual Basic Application development. option button. False. checkbox. The Picture box & Image box is used to display pictures and can show picture. The properties window also displays the name of the control that’s properties are currently displayed in the properties window. mouse. The . data control etc.10 The Project Explorer Window also contains three tool on the top border of the window. The toolbox generally contains textbox.

for huge number of item combobox is a better choice than the listbox. This window is non-interactive. If the items are large enough then the scrollbars will automatically arise. The data control is used to connect database with the current application. So. Object Browser Window The Object Browser Window displays the classes and their members & events associated with the class. This window provides an idea to the user about the viewing size. circle etc. User can set the position of forms on the screen by dragging the forms in the form-layout window. vertically. oval. by clicking the first tool View Code present in the top border of project explorer window. It is also possible to open code window by clicking on the code menu item present under view menu. square. Drivelistbox. Form-Layout Window The Form-Layout Window is the preview of the forms of the current application. The shape control is used to display general shapes like rectangle. directories present in the current selected drive & list of files present in the currently selected directories.11 listbox contains list of items which are displayed any time in the box. The scrollbars are used to scroll a particular component or. The code window can be opened by double-clicking on any component of the form or. colors of the forms of the application which is under development. directorylistbox and filelistbox are used to handle drives present in the system. The combo box is same as listbox which can contain any number of items but display only one at a time which is currently selected. This window also displays the methods present in the class. Listbox is generally used to display few number of items. contents horizontally or. Code Window The Code Window is used to write codes which are internally executed to perfectly execute the program and displays required information. The object browser window contains all the classes .

This window also contains list of objects present in the current application in bold letter. This window displays the immediate values of variables which are under debug. Visual Basic automatically recognize syntax errors at the time of editing logical errors can be removed by checking the value of variables using the immediate window. Immediate Window The Immediate window is generally used to debug logical errors related to variables. methods & events.12 present in visual basic and their associated properties. .

after that click on OK. then click on Add button.Allow addnew. Enter user-name and password again under the tag ‘authentication’.0 (OLEDB). Select Microsoft OLEDB provider for Oracle in the tag ‘Provider’. Select Use Connection String under general option & click on build button. click on Apply & finally click on OK. Set datasource name adodc1. after that once more click on OK.13 Qn. click on Components & select Microsoft ADO Data Control 6. Select Microsoft ODBC for Oracle & click on Finish (a dialog box appears). Such as. Double-click on DataGrid & arrange on the form. Now click on apply & then click on Close. Right click on Adodc1 & click on Adodc properties. Step 2: Open Visual Basic IDE (Integrated Development Environment). Click on Apply & then Close. Step 4: Right click on toolbox & select Components. Steps to connect Oracle with Visual Basic are as followsStep 1: Click on Start & go to Control Panel. Fill some value in the box & then click OK. right click on toolbox. Under resource select 2adcmdTable under the table option. Allow delete. Click on Administrative Tools and then click on Data Source (ODBC).0 (OLEDB). Step 3: Select Adodc from toolbox. drag it on the form & set the control. Allow update etc. Click on System DSN. Supply user-name & password & click on test connection. How to connect Oracle with Visual Basic? Ans. select Microsoft DataGrid Control 6. Set all the properties of datagrid related to records true. .

For example:. click. mousemove. lostfocus. DblClick. mouseup. deactivate. gotfocus. The first component is the properties of the object which are displayed in the properties window with name and values. line etc. paint. keydown. What is Event Driven Programing? What are its properties? How does it take place in Visual Basic? Explain with example. In Event Driven Programing various event actions are present. mousedrag. keyup etc. Visual Basic is an Object Based Programing language in which the form is the main object which contains the other objects necessary for an application.Click. function present in that object. keyup. The Second component is the method or. The properties values can be set by the user in the properties window or. keypress. mousedown. keyrealised. lostfocus. The method is activate using appropriate events and perform appropriate task.The form object has Circle. unload etc. Event Driven Programing is those type of programming in which a particular event is fired automatically when that type of event is occurred. For example. by using appropriate code. keypress. gotfocus. It is possible to link more than one events internally. Events are automatically fired or. load. Ans.The form object has the popular events activate. mousemove. methods to draw appropriate figure on the form which can be active by supplying some event. dblclick. Events are automatically called same as interface function of Java when appropriate event action is arised. The methods cannot be automatically invoked or fired from the external action.The click event of a . For example. User cannot change the name of the events as well as the argument list and argument type of events. The events has fixed properties. Every object has three components in Visual Basic. resize. Such as.14 Qn. invoked when such type of action event will arise. The Third components of any Visual Basic object are the events associated with the object. & appropriate action is automatically performed by the Visual Basic. In Event Driven Programing a particular action event is performed by the user and internally appropriate code block written under that event is automatically fired & executed & required task is performed. cls.

In Visual Basic every component contains huge number of events but few are unable for a particular application. CInt(255 * Rnd)) End Sub The background color of form1 will automatically changed when the mousemove action event is arise on the form. It is possible to define more than one events related to a particular action.15 form will automatically invoked when a double-click action is arise on the form. CInt(255 * Rnd). . The events are marked using the mouseclick sign with yellow colors. For exampleWrite a Visual Basic Application to change the Background color of a form when a MouseMove action event is arise on the form. User define the events in the code window which are necessary for a particular application. fired when such type of action event is performed by the user. Step 1: Design a form such as form1 and set the Caption “COLOR EXAMPLE” in the properties windowStep 2 : Open code window and select the MouseMove event & set the BackColor property of form1 randomly asPrivate Sub Form_MouseMove(Button As Integer. X As Single. The defined events are automatically active or. The events are listed in the combo box present in the upper right corner of the code window. Y As Single) Form1.BackColor = RGB(CInt(255 * Rnd). Shift As Integer. User can define any event associated with created objects present in the combo box upper left side of the code window. The Object Browser Window displays all the components present in the objects.

In combo box multiple selection of element is not allowed. Alternately. 2. Combo Box displays only one element at a time. The List Box control is very popular control present in the toolbox to display list of elements. By default.16 Qn. Combo box is useful to store huge number of elements. The list box displays one element in a row and can display more than one element at a time. When the display area is filled then a vertical scrollbar will automatically arise. . multiple elements can be selected. Write down the method showing that a particular list box item is selected. Ans. Combo Box is arised using the Combo box control. List Box 1. List Box displays more than one element at a time. 3. we can say that list box is a matrix of single column & multiple rows. multiselect properties is not present. The Combo Box is same as list box but only one element is displayed at a time in the combo box. List Box is arised using the list box control. 2. 4. multiple elements cannot be selected. Explain the difference between Combo Box & List Box. 4. Combo Box 1. Combo Box is useful for huge number of elements. 3. In list box. single element can be selected from a list box but it is possible to select more than one element from a listbox by changing the properties multiselect of the list box. So. In combo box. List Box is useful for few number of elements.

Step 2: Select VB6 Data Form Wizard and click on the check box loaded/unloaded under load behavior & click on Ok. SYSTEM. Methods to connect any type of database using Add-In manager are as followsStep 1: Click on Add-Ins on standard menu bar & go to Add-In manager and click. And click on Next. Ans. Step 8: Step 9: Step 10: Step 11: Select appropriate layout of the form and click on Next. Write methods to connect any type of database using Add-In manager. It is also possible to supply username created by the user itself. Select fields for the form and click on Next. Select Table Name under the record source. Step 3: Click on Data-Form Wizard under Add-Ins menu & click on Next. Delete extra forms under the project. Step 4: Select Remote(ODBC) and click on Next. . We must supply corresponding password according to the username- System – Manager Scott – Tiger Internal – Oracle It is also possible to supply password of user created user. For Other DatabaseOnly supply DSN name created by the user using Control Panel. We must supply UserId as SCOTT.17 Qn. INTERNAL etc. Step 5: For Oracle DatabaseSupply DSN name created using Control Panel for Oracle Database.

The Modeless Dialog Box allow shifting of focus between the Dialog Box & another form without closing the dialog box. we can say that the Common Dialog Boxes are a custom control that displays the commonly used dialog boxes such as. if it is 4 then the “Font” dialog box will be opened and so on. Modeless Dialog Box A Model Dialog Box does not allow the user to continue with other application unless it is close. By supplying the action property appropriate dialog box can be displayed as the requirement of the user. If the action value is 1 then “Open” dialog box will be arise. Font.Open. In Visual Basic three types of dialog boxes are present according to the creation of the dialog boxes:1. Model Dialog Box 2. Message Box & Input Box are Model Dialog Box. Save As. if yes how? Ans. if it is 3 then the “Color” dialog box will be open. Alternately. When a Common Dialog Box is created on a form it automatically resizes itself & it is invisible at run-time. It is also possible to display a form as a dialog box in Model or. Dialog Boxes are generally pre-defined interface which are used to take input values or. Common Dialog Boxes are generally present in the Microsoft Common Dialog Control 6. Color. display messages in Visual Basic Application. What is Common Dialog Box? Explain Message & Input Box with a suitable example. In Visual Basic two types of dialog boxes are present according to the interaction with the user and the display behavior of the dialog boxes. The Dialog boxes are divided in two categories1. Print.0 under the components. Custom Dialog Boxes . if the action value is 2 then “Save As” dialog box will be open. Help etc. Is form may be created as a dialog box. Generally. Modeless form. Standard Dialog Boxes 3.18 Qn. Pre-Defined Dialog Boxes 2.

Any dialog type can be used in Message box which are allowed in Visual Basic. function and write the statement:Form1. The title is also a string which should be supplied by the user. under the project menu.show <For Model Dialog Box> Form1. The default value is VBOKONLY.dialog type. The first argument is displayed as a message to the user and the second argument is displayed as a title on the caption of the form.19 Pre-Defined dialog boxes are generally Message Box and Input Box which can be displayed anywhere and in any application as the choice of the user. The Message Box is a pre-defined model dialog box to display anything as a pre-defined form. Common Dialog Boxes are those dialog boxes which are created by the user using form & appropriate control & which can be used in Visual Basic Application as a Model or Modeless form.”Title”) The message is a string which is displayed on the Message Box and should be supplied by the user. The dialog type specify which buttons are displayed on the message box. It is not necessary to add any control to handle dialog boxes. User can display the form by calling any sub-routine or. The general form of Message Box isMsgbox (“Prompt”. It is also possible to supply integer values corresponding to dialog type. If the dialog type is provided by the user then the message box return an integer value corresponding to the clicked button on the message box. The Input box always returns a string value and can take two string type arguments.show (1) <For Model Dialog Box> . Input box is also a pre-defined dialog box of model type. User can test the clicked button which is clicked by the user according to the returned value of the user. it is possible to display a form as a dialog box in Visual Basic Application:User can add a form in any visual basic application using the add form tools present in standard toolbar or. Yes. The form should be hidden in the load event of the main form.

Controls are system-defined object present in the toolbox to handle Visual Basic program. 4. 15. 3. User can define any events as the requirement of the user. The events are automatically fired when appropriate action event is arised. 12. The next components are the events associated with the control. 11. How can you set in the control properties with the help of code? Ans. 19. 9. What do you mean by Control? Explain 5 important controls with their properties and event. 13. 20. The last property of control are the methods present in the object which can be called by supplying appropriate arguments associated with the object. popularly used controls are present in the toolbox. Command Button Text Box Picture Box Label Frame Check Box Option Button Combo Box list Box Horizontal Scrollbar Vertical Scrollbar Timer Drive List Box Directory List Box File List Box Shape Line Image Box Data Control OLE . Generally. Data member which are displayed in the properties window after selecting the object. it has three types of componentsIdentifying properties or. In Visual Basic the most popular controls are present1. 10.20 Qn. Every control present in the toolbox is pre-defined object and so. 7. 17. 8. 6. 2. 5. 18. 16. 14.

Using command button user can invoke any event associated with the command button and can perform any task. The 0 indicates flately appearance and 1 indicate 3D appearance. deactivate the command button. The BackColor property is used to set the Background Color of the command button. etc. The Appearance property is used to set the appearance of the command button.. The color can be active if the style is graphical. The Font property is used to set the font property of the caption of the command button. The Command properties: Name  Appearance  Backcolor  Caption  Enabled  Font  Picture  Style  Tool Tip Text  Visible etc.21 Command Button Command Button is the most important control present in the toolbox to handle visual basic application.command2. It is also possible to highlight a character on the caption by a preceding ampersand (&) symbol. Its value is 0 & 1. If the value is True(default) then it is Active. if the style property is graphical. Command3…. If it is False then it is Deactivated. The picture property is used to set picture on the command button. User can set the graphical style by setting value 1 in the style. Style property is used to set the looking of the command button which is by default 0(standard). Button has the following popular The name of command button which is generally command1. The enabled property is used to activate or. The TabIndex property is used to set the sequence order of the command . The caption property is used to set the label of the command button which is displayed on the command button. is the internal identifier which can be used in coding to perform appropriate task associated with the command button.

control activate the button. The GotFocus event will automatically activate when the cursor or. Similarly. Similarly. the LostFocus event will automatically activate when the control goes from the button. The MouseDown event is automatically called when any button of the mouse is pressed by the user. The KeyDown event will automatically invoked when any key present in the keyboard pressed by the user. The Click event will automatically invoked when user click on the command button. Text Box The Text Box control is also a very important common control present in the toolbox.listbox. checkbox or. User can also display calculated results in textbox. . The TabIndex value is automatically started from 0. The textbox control is generally used to take input values from keyboard. other common dialog boxes. Similarly. The MouseMove event will be automatically called when the mouse is moving on the button. The Command Button has the following popular Events: Click  GotFocus  LostLocus  KeyDown  KeyPress  KeyUp  MouseDown  MouseMove  MouseUp etc. The Tool Tip Text property is used to set a pop-up text when the cursor is on the command buton. the KeyUp event will automatically activate when any key is released by the user.22 button during execution. combobox. It is also possible to supply values from other controls such as. The visible property is used to set the visibility of the command button which is by default True. If it is false then the button will be disappear. The KeyPress event will automatically called when any key printable or nonprintable is pressed by the user from the keyboard. the MouseUp event will automatically called when the mouse buttons are released by the user.

etc. The DataField can work if the DataSource is set. The 0 value indicates Flat looking. unset borders around the textbox which is by default fixed single (1). Using this property user can specify the type . The DataField property is used to set the field name of a database which is displayed during execution.23 The general properties of TextBox are Name  Alignment  Appearance  Backcolor  Forecolor  BorderStyle  Datafield  Dataformat  Datasource  Enabled  Font  Locked  Multiline  PasswordChar  Scrollbars  Tabindex  Text  Tooltiptext  Visible etc. The 0 value provide no border. text2. The Appearance property is used to set the looking of textbox which is by default 3D(1). Text3…. the ForeColor property is used to set the foreground color. Similarly. The BackColor property is used to set the background color. 1 indicates Right alignment and 2 indicates Center alignment. The DataFormat is used to set the format property of the textfield. The Alignment property is used to set the display alignment of the box which is by default left alignment(0). The name property is the internal name of textbox object which is generally text1. The BorderStyle property is used to set the borders or.

Similarly. the lostfocus event will automatically activate when the control goes from the button. The DataSource property is used to link a textfield to a DataBase field. The keydown event will automatically invoked when any key present in the keyboard pressed by the user. The scrollbar property is used to set scrollbars around textbox. The text property is used to set text into the textbox as well as get the text present in the textbox. deactivate the textbox. Similarly. The Locked property is used to set the editable true or. It is also possible to set scrollbars around the textbox. This property can be activate if the multiline property is True. The keypress . The gotfocus event will automatically activate when the cursor or. The PasswordChar property is used to set the password character during inputting into the textbox. control activate the button. the keyup event will automatically activate when any key is released by the user. This property can be set if multiline is false. The MultiLine property is by default false that means only one line can be inputted. The visible property is by default True. If the value is true then it is not possible to write anything in the textbox. The default value is True. This property can be activated automatically when the multiline is true. The Font property is used to set the fonts of the textbox with style and size. The textbox has following popular events           Change Click Dblclick Gotfocus Lostfocus Keydown Keypress Keyup Mousedown Mousemove Mouseup etc. The click event will automatically invoked when user click on the command button. The change event will be automatically called when any changing is performed on the textbox. This character is displayed during typing. false which is by default false. If the property is false then the textbox will be disappear.24 of the textfield which is by default string. The Enabled property is used to activate or.

Control can not focus on label. LABEL The label is as same as text box. the mouseup event will automatically called when the mouse buttons are released by the user. The mousedown event is automatically called when any button of the mouse is pressed by the user. Similarly. It is not possible to write text on label using keyboard directly. . it is only read only property contains. non-printable is pressed by the user from the keyboard. The move method is used to move the textbox from one location to another. Font  Tab Index  Name etc. The following popular methods are present with textbox Setfocus  Move  Refresh etc. The only difference is that. The mousemove event will be automatically called when the mouse is moving on the button. Label has the following popular properties: Alignment  Appearance  Auto size  Back Color  Border Style  Caption. The refresh method is used to refresh the textbox by deleting unwanted values.25 event will automatically called when any key printable or. The setfocus method is used to move the cursor to the textbox. Label has no events related to keyboard. User can change the caption of label at run time by supplying some text.

User can browse the data in the list Box and select one or more items as the requirement of the user. The user can not edit the data in the list box directly.26 A Label control has the following popular events: Click  Dbl Click  Mouse Down  Mouse Move  Mouse Up etc. So. Label control has the following popular methods: Drag  Move  Link Request  Refresh etc. List Box List Box is one of the most important controls present in tool Box which contains a list of data in the form of string. it occupies maximum space on the form container in comparison with Combo Box. List box always displays some list of elements as the size of the list box. The popular properties of List box are: Appearance  List  Columns  Data Field  Data Source  Enabled  Font  Index . it is suitable to display few numbers of elements using List Box. So. When the list box of data is to long then Visual Basic adds a vertical scroll bar.

The column property is used to set the multiple columns in a List Box which is by default 1. The Data-source property contains the Database name and the Data Field property contain the field name. The MultiSelect property is used to set the MultiSelect option of the ListBox which is by default false. if the user change the columns property by two or three then List Box contains two or three columns as same as news paper columns. The List property is used to supply list of element to the List Box at design time. The Font property is used to set the Font name and Font size of the List Box. The Index property of elements are automatically starting from 0 (zero) and increment by 1. The Name property is used to set the internal name of the ListBox. User can link a Database with List Box using Microsoft Data Bound List Control. Using the properties Data Source and Data field.27 Tab Index  Multi Select  Sorted  Visible etc. The ListCount property returns the total number of element present in the ListBox. User can select any elements from the multiple columns List Box as and when required. that’s value will populated the list box. The ListIndex property returns the Index number of the selected items. The Text property returns the name of the element which is currently selected. which is by default false. Microsoft Data List Control. If the property is true then list of elements will be displayed in alphabetical order. The Back color property is used to set the Background color of the List Box. a List Box can be connected with a database and with appropriate field of the Database. User can set the starting Index using the index property. The selected property is used to test a particular element is selected or not. The stored property is used to set the order of element of the ListBox. The ListBox has the following popular events: Click  DblClick  GotFocus  LostFocus  . The List Box will automatically populated with the values of the fields which is internally connected. The Appearance property set the property is used to set the looking of List Box as flat or 3D.

The Combo Box is also known as Dropped Down Box. the only difference is that it displays a single element which is currently selected but can contain any number of elements.28       KeyPress KeyUp MouseMove MouseDown MouseUp Scroll etc. In . The Combo Box comes from combination box which is the combination of Text Box and List Box. The ListBox has the following popular Methods: AddItem  Remove Item  Clear  Set Focus etc Combo Box The Combo Box control is as same as ListBox. The Combo Box control is most suitable for a huge number of elements. A Combo Box controls allows the user to select a predefine item from a list and enter new value not in the list.

Multi Select property is not present. The Style value 2 indicates Drop Down List. starting from 0 to 2. it is a list box with Text Box. It is a List Box rather then a Combo Box. The style property 1indicates simple Combo Box. In which the list is permanently displayed. That means. The Style property is used to set the behavior and appearance of the Combo Box.the 0(zero) style indicates drop down combo which looks like standard text box with a drop down arrow to the right side. Clicking the arrow opens a list under the Text Box. The Style can be of three types. That means. it is not possible to select multiple elements. The Combo Box has the following popular properties: Appearance  BackColor  Datasource  DataField  Enabled  Font  Index  List  ListIndex  Sorted  Style  Text  Visible  TextVisible etc.29 Combo Box. The Combo Box has the following popular Events: Click  DblClick  KeyPress  KeyUp  GotFocus . Only selected item is displayed on the Text Box. After selecting the selected item is displayed in the text box or user can enter element to select appropriate element. It looks identical with a drop down Combo but it is not possible to write any thing in the Text Box.

Directory List Box and File List Box are combindly used to access any files from any Directory present in any drive. . both the three list boxes should be present in a single application. DRIVE LIST BOX The Drive List Box is a special type of Combo Box which is automatically populated using the drive present in the system. Using the Drive List Box user can select any drive present in the system and consequently corresponding changes can be perform on Directory List Box. The Combo Box has the following popular Methods: AddItem  RemoveItem  Clear  Move  SetFocus etc. The Drive List Box. So. The Drive List Box has the following popular properties: Appearance  Drive  Font  Index  List  ListCount  ListIndex  Name  visiable etc.30  LostFocus  Scroll etc. The drive property is used to set the drive name which is automatically selected other wise the Drive Property can be changed by using the change events in the Drive List Box.

The Directory List Box has the following popular Methods: Drag  Move  SetFocus  Refresh  ZOrder etc Directory List Box The Directory List Box extends List of directory present in the Drive List Box. The user can select any directory List Box and corresponding List of Files are displayed in the file list Box if the path is properly specified.31 The Drive List Box has the following popular Events: Change  GotFocus  LostFocus  KeyPress  KeyUp  Scroll etc. The path should be specified in the change event in the Directory List Box. The Change event is the most popular events present in the Drive List Box which is automatically executed when it makes a selection in the Drive List Box. The popular properties of Directory List Box are:- Appearance BackColor Enabled Font Index List ListCount ListIndex Name . That means. Directory List Box can not be work properly. without Drive List Box. If the Directory List Box is also attached then corresponding changes automatically performed in the Directory List Box.

File list box The file List Box is present at the list of Drive. It is usually accessed in the change event for the Drive List Box. User can select any file from the file list box.32 Path Visible etc The Path property is a run time property. . That means file List Box can not be work properly without directory list box. That sets or returns the path to the Directory in the Directory List Box. Directory List Box change event to update the list of files in the File List Box. It is used to list the actual file names which are currently present in the selected directory in the directory list box. The popular methods present in the Directory List Box:-  Drag  Refresh  Move  SetFocus etc. To open the file or display the content of the file as then choice of the user the content of file list Box will automatically changed if the path property is set under the change event of directory list box. Directory and File List Box. The change event will automatically triggered or called when any changing is performed in the Directory List Box to select other Directories. The popular events present in the Directory List Box :-  Change  Click  KeyPress  KeyUp  GotFocus  LostFocus  MouseDown  MouseUp  Scroll etc. the path property is also used in the Directory List Box.

The pattern property is used to set the pattern or type of the file which are displayed in the file list box. The path property is used to set the directory name that’s content will be displayed in the file list box. For Example:- *. The hidden property hide the List Box same as visible property.cpp Displayed all cpp files *.java Displayed all java files         The file list box has the following popular events :Click DblClick KeyPress KeyUp LostFocus GotFocus MouseDown MouseUp . The File Name Property returns the name of the file which is currently selected. This property is by default False this property is useful for system files.33 The popular properties of File List Box are: Appearance  BackColor  Enable  FileName  Font  Hidden  List  ListCount  ListIndex  Name  Path  Pattern  Selected  Visible etc.* indicates all file *.

It is not possible to select more then one radio button at a time in a particular form.     FRAME Frame control is a sub container as form which can contain any other control present in the ToolBox to form a new group. The popular properties of Frame are: Appearance  BackColor  BorderStyle  Caption  Enabled  Font  Name  Visible etc. User can drop any number of frames on a particular form and can design more then one groups of radio button as well as check box.34 Path Change PatternChange Scroll etc. The path change events occur when the file path properties changed. Similarly the pattern change event called automatically when the pattern property is changed. Generally in a particular form only one radio button can be selected at a time. It is possible to select a single radio button from each group. To implement the concept of grouping of radio button as well as check boxthe frame control is used to form different groups. The popular Methods present in file list box: Move  Refresh  SetFocus etc. Ultimately more then one Radio Button can be selected at a time by grouping then using the frame control. The Frame control has the following popular events:  Click DblClick . But in some situation more then one Radio Button should be selected of different groups at a time.

The default value is false. If the Button is selected then the value is true other wise it is false. The Radio Button control has the following popular properties: Alignment  Caption  Enabled  Font  Appearance  BackColor  Name  Picture  Style  Value  Visible etc. It is not possible to select more then one Radio Button in a particular group. If user wants to select more then one Radio Button then the concept of grouping should be used using the frame control. Radio Button is also called option Button.35    MouseMove MouseUp MouseDown etc. Radio Button Radio Button is a Boolean type control that’s value can be true or false. Frame control has the following popular methods: Drag  Move  Refresh etc. Radio Button has the following popular events:Click DblClick GotFocus Lostfocus KeyPress Keyup MouseMove        .

if it is not selected then the value is 0 (zero). If the check box is selected then the value is 1.36   MouseUp MouseDown etc. The Radio Button has the following popular methods: Drag  Move  SetFocus etc. if it is grayed then the value is 2. Check Box The Check Box control is as same as Radio Button but more then one check box can be selected at a time of a particular group. Check Box has the following popular properties: Alignment  Appearance  BackColor  Style  Caption  TabIndex  DataSource  DataField  Enabled  Font  Index  Name  Value  visible etc. Off and Grayed (neither ON nor Off). The Check Box has the following popular events: Click  GotFocus  LostFocus  KeyPress  KeyUp  MouseMove . The other difference is the check box has three value – ON.

oval etc.Rounded Rectangle . SHAPE The Shape control is used to draw different Shapes like square. The interval is by default 0(zero).37   MouseUp MouseDown etc. Timer has the properties Enabled. User can set the Interval as the requirement of the user.that is Timer. using this control user can display different predefine shapes by supplying value of the Shape property of the Shape Control. The Timer control has no methods. rectangle. Interval etc. User should writes the codes which will be executed automatically until the Timer enabled property False. If it is False then the Timer will not work.     Check Box has the following popular Methods:Drag Move Refresh SetFocus etc Timer The Timer is one of the most important and popular control present in the Tool Box.Oval 3 – Circle 4 . That means the cycle will appear after 0 mili second. the enabled property is by Default True. Those type of task which can be automatically executed should be present under the Timer event.Rectangle (By Default) 1 . The Shape control can draw six types of predefine Shapes as:- 0 . Timer control is not displayed at the time of execution on the container. circle. The Timer control has only one event.Square 2 .

All the three types are commonly known as ActiveX control.Visual Basic is a front end programming language to design appropriate interface to interact with the data base present in other programming language like Oracle. Add-In. Standard exe application is general type of application in visual basic which is used to develop stand alone application using the visual basic control. SQL server etc.Discus the various type of application that can be created in visual basic ? Ans :.38 5 – Rounded Square The Shape control has the following popular properties:        Name BackColor BorderStyle BorderWidth FillColor FillStyle Shape Visible etc The Shape control has no events and no Methods. ActiveX control are divided in three categories as:- 1. It is also possible to embed other application in visual basic application. Control Common ActiveX . ActiveX Control. DHTML application etc. Ques :. In visual basic three types of controls are present of develop visual basic application. type etc. ActiveX exe. Visual Basic application are divided in various categories and they are generally standard exe. Although it is a front end tool but any type of application except system software can be developed using visual basic. Using the concept of OLE and user can concurrently execute more than one program in a visual basic application. ActiveX Dll. Using Visual Basic stand alone application can be develop as the requirement of the user by providing attractive interface to the user it is also possible to developed web based application is Visual Basic to monitor the network system as well as the communication rate.

Fore example in visual basic IDE . But this concept is not true for Dll. Command Button. Components can be added by clicking on components present under project menu. Frame. List down the various step to create a new Tool Bar? Ans :. ActiveX Control 3. The ActiveX exe is used internally as a exe file. Using the concept user can create common classes. modules for their own and can be shared with any VB application. User can create ActiveX controls as the choice of the user by clicking on add user control menu item present under the project menu using this option user can create any type of control for their later application. Flex Grid Control and all the components present in the list. Ques :. Dll statements are treated as a simple VB statement and executed as simple statement. Dll components are executed by the VB interpreter when the actual application is executed. Besides the above two controls huge no of extra control are present in visual basic which are commonly known as components. That means ActiveX exe applications are created as templet and can be used in any visual basic application. Image List Box. functions. The ActiveX Dll is same as Active exe. That means ActiveX exe are generally by default for all other application. ActiveX exe applications are those type of application which are used to create common classes as well as modules. Label etc.Tool Bar is a horizontal single line container which contain different buttons (Command Button) with images (Optional) to perform different task assigned with the corresponding buttons. An application can also be treated as a control for the later application. That means ActiveX exe can not be work without crating exe file. Generally extra components are Status Bar. Common ActiveX Controls are generally pointer Picture Box.What do you understand by a tool bar. Controls or Component User Created Extra ActiveX Common ActiveX controls are those controls which are commonly used in visual basic application and present in the tool box automatically. It is also possible to add component by right clicking on tool box and click on components.39 2. which can be used in any visual basic application. Tool Bar. ActiveX exe statements are directly executed without interpreting it.

All the common controls are visible in the tool box. Double click on the tool bar control. Click on Ok. 9. User can create own tool bar which is present under the component Microsoft windows common control 6. Tool tip text. This line is called standard tool bar which is given in the VB IDE. 11.40 the second horizontal line contains different symbols for the popular operations as well as controls necessary visual basic application. Right click again on tool bar and click properties. 4. The tool bar is visible in the upper horizontal position of the form. Keys. Select Microsoft windows common control 6. In visual Basic two types of interfaces are present. 8. Beside image list and click on apply and Ok. User can create this type of tool bar as the requirement of the user to perform different task assigned in the tool bar components. It is also possible to remove existing buttons by click on remove button option. 2. Right click on image list and click on images button. Discus the various uses of user interface and their use? Ans :. Style.User interface is the interaction point on which user can interact with the application and can perform various operations associated with the interaction point user generally interact with the controls present in the main container form and active other interfaces. Under general operation select the image list menu. 7. 1. Right click on tool bar and click on properties after that click on button tool start adding buttons by click on insert button and specify caption. On the buttons present in the tool bar. picture for the list To insert picture in the image list.What do you mean by user interface. Separator etc. If user wants to assign images on the button then double click on image list control present in the tool box. Modal Modeless . 5.0 and click on check box besides the option click on apply and close. 10. Ques :.0 Step to create a Tool Bar 1. 6. 2. Click on insert picture button and select at last click on apply and Ok. Right click on tool box Click on Component 3.

A modal dialog box does not allow the user to continue with other application unless it is closed. msgBox(“message”. It is not possible to open common dialog boxes without using common dialog control. Predefined dialog box 2. It is also possible to display a form as a dialog box in modal or modeless form. The modeless dialog box allows shifting of focus between the dialog box and another for without closing the dialog box. Generally MDI applications are modeless and SDI applications can be modal as well as modeless as the choice of the user. Message box and input boxes is modal dialog box. If the dialog type is provided by the user then the message box returns an integer value corresponding to the clicked button on the message box. Common dialog boxes are also modal dialog boxes. The dialog type specifies which buttons are displayed on the message box. Modeless interfaces are those interfaces in which user can work concurrently. title) The message is a string which is displayed on the message box and should be supplied by the user. Any dialog type can be used in message box which are allowed in Visual Basic. Common dialog boxes are also predefined dialog boxes which can be arise in any application with the help of common dialog box. 1. Standard dialog box 3. It is not necessary to add any control to handle dialog boxes.41 Modal interfaces are those interfaces before closing it other interfaces cannot be work. Custom dialog boxes are those dialog boxes which are created by the user using form and appropriate control and which can be used in visual basic application as a modal or modeless form. It is also possible to supply integer values corresponding to dialog type. Message box is a predefined modal dialog box to display any thing on a predefine form to general form of message box. User can test the clicked button which is clicked by the user according to the return value of . dialog type. The type is also a string which should be supplied by the user. In Visual basic three types of dialog boxes are present according to the creation of the dialog boxes. Custom dialog box Predefined dialog boxes are generally message box and input box which can be displayed any where and in any application as the choice of the user. that default value is VbOk.

6. Variable name is not case sensitive in Visual Basic. As is also a keyword used before the actual type of the variable. The form should be hidden in the load event of the main form. How do we create variable in VB? Discuss the various types of variables that can be used in VB programming with suitable example in each. Variable name must be start with an alphabet and up to 255 character of length.42 the user. 5. In Visual Basic variables are created using the Dim keyword as- Dim Variable name as type of variable Dim is a keyword which is used to create any type of variable. Variables is those types of elements that’s value can be changed during program execution. User can display the form by calling any sub routine or function and write the statement. The first argument is displayed as a message to the user on the input box. 7. 2. The input box always returns a string value and can take two string type arguments. Input box is also a predefined dialog box of modal type. 1. Ans. User can add a form in any visual basic application using the add form tools present in standard tool bar or under the project menu. 3. Alternately we can say that variable is the name of memory location. Integer Long Byte Boolean Single Double Currency Date . 8. that’s value can be changed during program execution. The second argument is displayed as a title on the caption of the form. Ques. In Visual Basic the following primitive types are present. 4. It is possible to display a form as a dialog box in visual basic application.

Variant String Besides the above type user can create any type of variable as the requirement of the user by using the type and end type keyword. Suppose user wants to create a new type ‘student’ in which name. User can store 100 records in the array A.Show It is also possible to create any type of variable present in the Tool Box and in the Component Dialog Box. roll. It is also possible to declare variable of existing object type. Example [kqn ls nsa . ActiveX DLL etc. For example. It is also possible to create variable of User Defined Classes created using Active EXE. year fields are present to it can be possible as:- Private type student Name as string Roll as integer Class as string Year as integer End type In the above student is an user defined data type in which name.43 9. 10. For Example:Suppose a form is created and user wants to create another form as same as form1. class and year are fields of corresponding type. roll. it is possible as:- Dim N Form As New Form1 N Form. class. A is a single Dimensional array of 100 blocks of student types.

A form is the main container to contain different types of controls present in the Tool Box or in the component dialog box or created by the user. In Visual Basic more then one form can be present in a single application and controlled from one another. To load a form a method load is present. The Load Method actually load the form in the primary memory as well as the components present in the form. The unload method is used to release the form from the primary memory. form is the main interface provided in Visual Basic application to interact with the application. That means. Ans. i. But in Visual Basic 6 a new concept MDI (Multiple Document Interface) is present. How can one form be controlled from within another? Explain. What is a form? Why do we use it? Explain the procedure for loading and unloading forms. The Hide Method just Off the visibility of the form. activate the form. The Hide method can not release the form and components from the primary memory. showing and hiding forms. . In Visual Basic automatically one form is arise in any application which is form 1. The Hide and Show method can not be work if the form is unloaded. When a form is unload then the form as well as the components present on the form release from the primary memory.e. All the other components can be present on the form.44 Ques. Without form components can not visible in Visual Basic application. In Visual Basic application the default application style is SDI (Single Document Interface) up to Visual Basic 5 only the concept of SDI was present. Form is a main class in which other classes can be inherit and corresponding action can be taken by the component according to the requirement of the user. The load methods also show the form. The Show method is used to display a form as well as all components of the form.

no document can be present. That means. All the child interfaces are entirely present within the parent interface. It is not possible to active more then one interface at a time. But in MDI (Multiple Document Interface) more then one interface can be active at a time and all the interfaces are present entirely in a parent interface. Out side of the parent interface. in MDI (Multiple Document Interface) parent child relation ship is build.45 In SDI (Single Document Interface) a single interface can be work at a time and the others are inactive. .