•Automatically opens in Break-mode
•To evaluate any executable statement
•To find and change the value of variables and properties.
•To Query or changethe value of a variable while running an application.
•Add Watch : In Break or Design Mode from the Debug Menu
•You can watch the expression, breaking when the value of the watch
expression is true or breaking when the value changes
•It shows the current watch expression
•The context column indicates the
procedure module(s) in which each watch expression is Evaluated
•You can edit a value
•Automatically displays all of the declared variables in the current
procedure scope and their values.
Calls Stack lists all active procedure calls in the Application that where
started but not completed. You can only display the Call stack window when
the application is in break mode.
q: You have two text boxes Text1 and Text2. the Tab index of text1 is set to
0. what will happen when u set the tab index of text2 to 0?
A: Tab index of text1 is set to 1
Which code fragment is proper use of the Forms collections?
A. Dim form1 As Form *
For each form1 in Forms
B. Dim form1 As Form
For each form1 in Forms
C. Dim form1 As Form
For each form1 in forms
D. Dim form1 As Form
For each form1 in Forms
Which property is only valid for a collection object?
C. Count *
What are the benefits of Forms collection?
- Allows faster unloading of all forms in the project *
- Faster access
- Standardized mechanism for tracking multiple instances of a form *
- Group forms & drag the group
Default firing order of events of a form?
A. Load, Initialize, Resize, Paint
B. Load, Initialize, Paint, Resize
C. Initialize, Load, Resize, Paint *
D. Initialize, Load, Paint, Resize
Start from Main, contain form1, Form1.caption = "blah". Which events will be triggered?
C. initialize, load *
D. initialize, load, activate
•How do you dynamically load controls : Load object_name
Q: What is the sequence in which the events in the form will trigger
A: Initialize, Load, Resize, Activate, Paint
Dim x As Integer
What event gets fired? Initialize
Which control can you place directly on an MDI-Form?
– Richtext Box
– Picture Box *
- Option Control
The PictureBox, Data controls, Timer controls and Menu controls are the only
standard Visual Basic controls that you can place in the internal area of an
Form1 contains a command button control that has code in one of its events.
To cut the control from form1 and than paste the control onto form2.
Where is the event located?
A. It is in the same event of the command button control of form2
B. It is in a different event of the command button control on form2
C. It is deleted when the command button control is cut from form1
D. It is in the General object procedures of form1 *
ProgressBar with visible property set true. To display progress of a lengthy
operation in you application. Which property will you set?
A. value *
DragOver Form1 to change color of label1
A. Target.color = true
B. Source.color = true *
C. DragLabel.color = true
D. DragControl.color = true
Form1 allow dragging Label1. Which line code use in DragOver event of Form1
to change bg color of Label1 to red?
A. Target.BC = vbRed
B. Source= vbRed *
C. DragLabel= vbRed
D. DragControl= vbRed
Which OleDragOver event parameter indicates dragging onto or away from a
B. state *
Copy picture from picturebox control to other app which prop use?
A. oledropMode of the picturebox control
B. oledropMode of the form containing pictureBox control
C. oledragMode of the picturebox control *
D. oledragMode of the form containing pictureBox control
You want to trap a function key in a textbox. - Use the Keydown event.
A textbox to allow only numeric entries. - Use the Keypress event.
Form1 and Form2 place code in the Terminate event of Form1. Which code to
add in order to cause the Terminate event of Form1 to occur from Form2?
A. F1.Click unload F1
B. F1.hide F1.close
C. unload F1 set F1=nothing *
D. unload F1 end
You have a Label1 on an UserControl1, what event for Label1 to be stretched
during design time?
D. Label1_Resize *
Q: You have a Label Control in USERCONTROL. If the user resizes the
usercontrol during run-time, in which event will u handle the resizing of the
label (so as to view the Label control)?
How do you find out if F2 is being pressed?
C. KeyDown *
Your form contains a command button control named Command1. The index
property of command1 is set to 0. You want to load a second instance of the
command button that has its index property set to
1. Which line should you use?
A. load command1.1
B. load command1(1) *
C. load command1.index = 1
D. load command1.index (1)
Combine menu controls of object1 with the existing menu on form1
A. form1.NegotiateMenu = true *
B. form1.NegotiatePosition = true
C. object1.NegotiateMenu = true
D. object1.NegotiatePosition = true
Using the NegotiateMenus property, you determine if the menu bar of a form
will share (or negotiate) space with the menus of an active object on the
form.If you uncheck the Visible property for a menu item, the menu items
below will move up to fill the empty space.
How to attribute Access Keys to menus? &Save
What can you do with a dynamic menu?
A. You can add function keys to it
B. You can add pop-up menus to it *
C. You can deleted it after creating it *
D. You can create it from the Menu Editor
How to allow menu items to be added at runtime?
A. redimension the menu control array
B. use the add method *//dynamic menu
C. use the load statement
D. set up the menu with blank spaces initially and change at runtime
Q: How will you allow users to edit your control at design time?
A: Set the EditAtDesignTime property of your UserControl object to True.
Q: How do you make your UserControl Object Invisible at run-time?
A: Set the InvisibleAtRuntime property of the UserControl object to True.
Menu control: Which property can only be changed during design time?
- shortcut *
How to refer to the contents of the child of the selected node of a TreeView?
Set nodChild = TreeView1.Nodes(TreeView1.SelectedItem.Index).Child
•tvwMyTree.Nodes(10).Children ‘ return the number of children
tvwMyTree.Nodes(10).Parent.Text ‘ return the Text of Parent
Display Icon for each item in the hierarchy of the website?
D. Treeview *
A TreeView control displays a hierarchical list of Node objects, each of
which consists of a label and an optional bitmap. A TreeView is typically
used to display the headings in a document, the entries in an index, the
files and directories on a disk, or any other kind of information that might
usefully be displayed as a hierarchy.
You are writing code for a Drag and Drop operation. You want to set the
DropHighLight property to highlight the target TreeView control element?
A. HitTest *
The DropHighlight property is typically used in combination with the HitTest
method in drag-and-drop operations for TreeView and ListView Controls.
You use the add method of the TreeView control, which parameter can you use
to control the creation of a child node?
C. Relative *
How to add the column to a ListView?
MyListView.ColumnHeaders.Add ,, "MyNewCol"
A unique feature of the Report view is ColumnHeader objects.
The ListView control contains a collection of ColumnHeader objects in the
What properties can you set while using the Add property for a list view?
•ColumnHeader object.Add(index, key, text, width, alignment, icon)
•Provide controls with images by using the ImageList control.
For which control does the ImageList control act as a central repository of
An ImageList control contains a collection of ListImage objects, each of
Which can be referred to by its index or key.
Dim pnlX As Panel
Set pnlX = StatusBar1.Panels.Add() ' Add a new Panel object.
Set pnlX.Picture = ImageList1.ListImages(1).Picture ' Setting Picture must
TreeView1.ImageList = ImageList1 ' Specify ImageList
TreeView1.Nodes(3).Image = 1 ' Use Index property of ImageList1.
TreeView1.Nodes(3).Image = "image 1" ' or Use the Key property "image 1."
What Property will you use to access BUTTONS of TOOLBAR?
Key & Index
Which StatusBar property allows the display of common data such as date, time
B. Style *
Statusbar SB1 Second panel set key property to panel2
Which display the message "blah" in second panel
A. SB1.(2)Text = ..
B. SB1.panels(2).text = .. *
C. SB1.Panels.(panel2).text = ..
D. SB1.PanelItems("panel2").text = ..
If you intend to add a user control or any ActiveX control to your form,
you must either add the control to the Toolbox, or add its License key to
the Licenses collection.
Private WithEvents extCtl As VBControlExtender
Private Sub Form_Load()
Licenses.Add "project1.WeeksCtl", "xydsfasfjewfe"
Set extCtl = Form1.Controls.Add("project1.WeeksCtl", "ctl1")
extCtl.Visible = True ' The control is invisible by default.
Q: When should you use public variables instead of property procedures for
A: The property is a String data type, and there is no constrain on the size
or value of the string.
Correctly use of ParamArray keyword?
- At the end of the (……. As….. , ……As ……, Param Array )
- And not in combination with the Optional keyword
You have a variable x. You use the Watch window to see the contents of x. At one time the value of x=100 and the next step is says. It has occurred when the 1 process was finished and the second process was started. How was x declared?
A. Local to 1st procedure *
B. Local to 2end procedure
C. Public in a procedure
D. Public in the General declaration section of the form
Procedure in class module visible to the project not to other application
A. private function Report1 as bool
B. private function Report1() as bool
C. public function Report1() as bool
D. friend function Report1() as bool *
A variable is declared as Public in a form. From where can the Variable be
A. Only from other procedures in the same form.
B. Only from forms in the same project
C. From anywhere in the same project *
D. From modules in other project
Which elements are supported in the definition of property procedures
- optional argument *
- address of operator
- alias keyword
- paramArray keyword *
You want a procedure to be visible only to objects in the current project.
You want that this procedure should be accessible by external clients.
How will you declare the Procedure?
How can you create a read-only property Private and a write-only property
Public. Which of the following are true?
•A. Private Property Get Name() As String *
Name = txtname.text
Public Property Let Name(ByVal NewName as String)
TxtName.text = NewName
B. Public Property Set Name() As String
•Name = txtname.text
Private Property Let Name(ByVal NewName as String)
TxtName.text = NewName
C. Public Property Let Name() As String
Name = txtname.text
Public Property Set Name(ByVal NewName as String)
TxtName.text = NewName
You have to indicate the property changes for an object.
Which of the following is best suited for the above scenario?
A. Property Get
B. property Let
C. Public Sub() *
D. Public Function()
How can you create a read-only property for a class?
A. Define a Property Get procedure and define a Property Let procedure with
B. Define a Property Get procedure and a Property Let procedure.
C. Define a Property Get procedure without a Property Set or Property Let
D. Define a Property Set or Property Let procedure without a Property Get
How can you create a read-only property?
A. Omit the Property Let procedure *
B. Omit the Property Set procedure
C. Set its ReadOnly property to true
D. Use the Private keyword when declaring the procedure
What are the two restrictions on how the Implements statement can be used?
A. It requires a reference to a type Library *
B. It can be used only once in an application
C. It cannot be used in standard module *
D. It cannot be placed in the general declaration section of a module
Q: What is the purpose of the Implements keyword?
•A: The Implements keyword is used to create a secondary interface.
For instance, if your application has a reference to a type library that
describes the IGrowth interface, you could create a secondary interface in a
class module using "Implements IGrowth".
You want to create an instance of an ActiveX component that can Asynchronously
signal projects that use it. What should you create? (Choose two)
A. an event
B. an object callback *
C. the Addressof Operator *
D. the Implements statement
Which type of Instancing should you use for the class module?
C. GlobalMultiUse *
Sink the events of class1. How define a variable MyVar
A. Dim MyVar as object
B. Dim MyVar as Variant
C. Dim MyVar as new Class1
D. Dim WithEvents my as class1 *
Q: Where and why to use Friend methods and properties
A: The combination of public to classes in the same project and private to
You have a Data Control with Bound Controls.
You want to provide the ability to abort changes in the record currently
being edited and to refresh the bound controls. How?
Only invoke the UpdateControls method for the Data control.
UpdateRecord Updates database (recordset) with data from bound controls.
UpdateControls Updates database (recordset) changes to bound controls.
Refresh Creates a new recordset based on data control properties.
Update Update recordset with data from bound controls or through code.
Your application has just deleted a record from a dynaset-type Recordset.
What is the current record? The delete record.
Which properties of the data control can be changed at run time?
Recordset, databasename, recordsource
•Q: A list-box is used as a constituent control. The design window is closed
and the control inserted on a form in another project. The user then sets the
sort property of the control which in turn sets the sort property of the
control. Why does the error occur?
A: Compile the control project ?
U have Form,a FRAME & ListBox inside frame. If u set SORT property of Listbox
at design time, what will happen.
box.AddItem item[, index]
DBGrid is a collection of Column objects.
the DBGrid control depends on two other objects:
•The Recordset object of the data control
•The Columns collection of the DBGrid itself
Each cell of a DBGrid control can hold text values, but not linked or
•Add a data control to a new form, and set its DatabaseName and RecordSource
properties to the database and table you want to display.
•Add a DBGrid control to the form, and set its DataSource property to the
data control you just created. The DBGrid column headers set automatically
from a Data control's Recordset object.
Q: How to set properties for the individual Column objects?
A: You must make the DBGrid control UI-active: Select the right mouse button,
and choose Edit. Then use pop-up menu.
Q: How to remove column header?
A: object.ColumnHeaders = False
Q: How to refer a colmun?
A: object.ColIndex [= value]
This property returns the zero-based index of a column within the Columns
Q: How to check the value of a specific field in the current record?
A: MyString = Data1.Recordset.Fields("Title").Value
The data in the currently selected row can be accessed using the Bookmark
property, which provides access to the underlying Recordset object’s current
You have 2 tables based upon which reports are to be generated by making use
of a common Field. The existing Table structure and Report definitions should
not be changed. Which of the following is most appropriate.
A. create a new table and use Filter
B. Create a new table and use Sort
C. create a new Dynaset using Filter*
Which type of recordset you will use to populate country names into a
ListBox? Forward-only Which recordset you will use to find a record in
multi-user environment? Dynaset
To locate specific records you can use the Find methods with dynaset- and
snapshot-type Recordset objects, and the Seek method with table-type
The Seek method works only with table type recordsets, because Visual Basic
uses the table’s current index
•table.Seek comparison, key1, key2 ...