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
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 ?
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
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.
16. which method of recordset is used to store records in an array.
17. What is the default property of datacontrol.
18 Which property of textbox cannot be changed at runtime
Ans : Alignment property, Tab Index etc
19. Describe In Process and Out of Process component?
In-process component is implemented as a DLL, and runs in the same process space as its client app, enabling the most efficient communication between client and component
An out of process component is implemented as an EXE, and unlike a dll, runs in its own process space. As a result, exe’s are slower then dll’s because communications between client and component must be marshalled across process boundaries
20. Under the ADO Command Object, what collection is responsible for input to stored procedures?
The Parameters collection.
21. What is the differences between flexgrid and dbgrid control?
Microsoft FlexGrid (MSFlexGrid) control displays and operates on tabular data. It allows programmatically sort, merge, and format tables containing strings and pictures. DBgrid is A spreadsheet-like bound control that displays a series of rows and columns representing records and fields from a ADO Recordset object.
22. What are different types of ActiveX components available in VB 6.0 ?
Standard EXE, ActiveX EXE, ActiveX DLL, ActiveX document, and ActiveX Control
23. How may type of controls are available in VB6 ?
Intrinsic controls - Default controls of VB6, These control are always available in VB6 Toolbox.
ActiveX controls - .These are extra controls which can be added into toolbox and this control having separate files (.ocx). Must be deployed separately along with application in other system.
24. Describe inprocess and out of process ?
An in-process component is implemented as a DLL called ActiveX DLL, and runs in the same process space as its client app, enabling the most efficient communication between client and component. Each client app that uses the component starts a new instance of it.
An out of process component is implemented as an EXE called ActiveX EXE, and unlike a dll, runs in its own process space. As a result, exe’s are slower then dll’s because communications between client and component must be marshalled across process boundaries. A single instance of an out of process component can service many clients.
25. What is the difference between Image and Picture box controls?
The sizing behavior of the image control differs from that of the picture box. It has a Stretch property while the picture box has an AutoSize property. Also picture box is a container control and support most of the graphics method.
26. What is the difference between a function and a sub (method) ?
Function always return a value, wheras am method may or may not return value.
27. What is the Default property of datacontrol ?
28. What are different types of recordset available in ADO ?
a) Table-type Recordset - Hold records from single table and can add, edit and delete.
b) Dynaset-type Recordset - Can hold editable records from multiple tables.
c) Snapshot-type Recordset - Hold read only records from multiple tables,
d) Forward-only-type Recordset - Hold read only records from multiple tables without cursor.
e) Dynamic-type Recordset -Holds editable records from multiple tables and changes done by other user also visible.
29. What is the difference between listbox and combo box?
Both are display list of items, however in combo box user can edit the item.
30. What is the difference modal and moduless window?
A modal form has exclusive focus in that application until it is dismissed. Moduless form are not required exclusive focus and it is default when we show any form.
31. What is the Object and Class?
Class is template from we can create objects, Objects are instantiate of a class. For example car is a class and Maruti 800, Maruti Zen are objects of car class.
32. How objects on different threads communicate with one another?
Processes communicate with one another through messages, using Microsoft’s Remote Procedure Call (RPC) technology to pass information to one another.
33. What is the Query Unload and Unload event in form
Query unload event occurs in a first and then unload event occurs, in MDI form we can trac child form closing status by using this event.
34. What are different locking type available in ADO.
a) LockPessimistic - Locks the row once after any edits occur.
b) LockOptimistic - Locks the row only when Update is called.
c) LockBatchOptimistic - Allows Batch Updates.
d) LockReadOnly - Read only. Cannot alter the data.
35. Name different ADO Objects?
36. What is the difference between a Property Let and Property Set ?
Let used to set value for ordinary variable and Set used to set value for object variable.
37. What is the difference in passing values ByRef or ByVal to a procedure?
a) ByRef -pass the address of variable not value
b) ByVal - pass the value
38. What is AutoRedraw event of Form and PictureBox ?
Automatically redraw the outputs.
39. What is DoEvents?
DoEvents command tell program control to execute other commands, while executing long task.
40. What is the size of the variant data type?
41. What is the the max length of Text Box?
42. What is the file extensions used in Visual Basic?
.frm - Form File,
.bas - Module File,
.cls - Class File,
.res - Resource File,
.ocx - Activex Control,
.frx - Form Binary File,
.vbp - Visual; Basic Project File,
.exe - Executable File.
43. What is Option Explicit ?
It enforce variable declaration.
44. What are different level of validation available in VB 6.0 ?
Field level and form level.
45. Can we add controls run time?
By using control array
46. How to declare Dll Procedure?
Declare function “<Function Name>” lib “<Lib Name>” Alias “<Alias Name>” (Arg, …..) as Return type.
47. What is Zorder Method of controls?
Set the control position in control stack, back and top.
48. What is Tabstrip control?
It is container control, by using tab control we can place more controls.
49. What is tree view control?
Display hierarchy of data like windows explorer.
50. What is OLE Automation?
Call external applications property and method in VB Application.
51. What is Create Object and Get object?
Create object - Create new instance of a class.
Get Object - Set reference of exiting object.
52. What is Static Variable?
Static variable retain its value outside of its scope.
53. What are the scope of the class?
Public , private, Friend
54. How to change the Mouse Pointer in run time?
By setting Screen.MousePointer value.
55. What are the available technologies for accessing database from Visual Basic 6.0?
DAO, Data Control, RDO, ODBCDIRECT, ADO, ODBC API.