You are on page 1of 3

isual Basic 6.

0 (VB6) Interview Question and Answer

1. How do you register a component?

Compiling the component, running REGSVR32 MyDLL.dll

2. What does Option Explicit refer to?

All variables must be declared before use. Their type is not required.

3. What are the different ways to Declare and Instantiate an object in Visual Basic 6?

Dim obj as OBJ.CLASS


Set obj = New OBJ.CLASS

or

Set obj = CreateObject (“OBJ.CLASS”)

4. Name the four different cursor types in ADO and describe them briefly.

Forward Only: Fastest, can only move forward in recordset.


Static: Can move to any record in the recordset. Data is static and never changes.
KeySet: Changes are detectable, records that are deleted by other users are unavailable, and
records created by other users are not detected
Dynamic: All changes are visible.

5. Name the four different locking type in ADO and describe them briefly.

LockPessimistic: Locks the row once after any edits occur.


LockOptimistic: Locks the row only when Update is called.
LockBatchOptimistic: Allows Batch Updates.
LockReadOnly: Read only. Can not alter the data.

6. What are the ADO objects? Explain them. Provide a scenario using three of them to return data
from a database.

Connection: Used to make a connection between your app and an external data source, ie, sql
server
Command: Used to build queries, including user-specific parameters, to access records from a
data source
Recordset: Used to access records returned from an SQL query. With a recordset, you can
navigate returned records. You can also add, modify or delete records.
7. List out controls which does not have events

shape, line controls

8. To set the command button for ESC, which Property has to be changed ?

Cancel

9. What is OLE Used for ?

Object linking and embedding, for using to other object classes like word, excel , autocad objects
in our own applications, only thing we have to add reference for these objects

10. Which controls have refresh method?

Checkbox, comna, combo, list, picture, ADo control, Data,Datagrid, Datareport,Dir list biox,
filelistbox etc

11. Early Binding vs Late Binding - define them and explain?

Early binding allows developers to interact with the object’s properties and methods during
coding permits the compiler to check your code. Errors are caught at compile time. Early binding
also results in faster code
Eg : Dim ex as new Excel.Application

Late binding on the other hand permits defining generic objects which may be bound to different
objectsyou could declare myControl as Control without knowing which control you will
encounter. You could then query the Controls collection and determine which control you are
working on using the TypeOf method and branch to the section of your code that provides for
that type
Eg : Dim ex as Object
set ex =CreateObject(“Excel.Application”)

12. Can I send keystrokes to a DOS application?

AppActivate (”C:\windows\system32\cmd.exe”) ‘ Appilcation caption


SendKeys (”SA”) ’For sending one string
SendKeys “% ep”, 1 ’ For sending Clipboard data to Dos

13. How do I make a menu popup from a CommandButton

Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As


Single)
If Button = 2 Then
PopupMenu Menuname
End If
End Sub

14. What is Option Base used for in VB6 ?

Option Base is to set the Index of the Array to start from 0 or 1.Like option explicit.. declare
“Option base 1″ at the top. now the array will start from Index By default the index starts from 0.

15. How to copy text to the Windows clipboard and from it.

Clipboard.SetData
and
Clipboard.GetData

You might also like