TechView with Kamlesh khaliya

Resources for OCP, Oracle Interviews(kamleshkhaliya@gmail.com)

Friday 24 August 2012

Iinterview Questions and Answers of VB 6.0


Q. What is the getArray in recordset?
Ans - GetArray([$number_of_rows])
Generate a 2-dimensional array of records from the current cursor position, indexed from 0 to $number_of_rows - 1. If $number_of_rows is undefined, till EOF.


Q. What is the difference if you register a dll from command or GUI?
Ans – If you register a dll through command you will not be able to view it in GUI, but if you are registering it with GUI it will be visible in GUI for further reference.

Q. What are the property methods Get, Let and Set?
Ans –
Property Get : this property method always returns a value of property.
Example :
' this could be in a usercontrol
Dim m_Caption As String
Public Property Get Caption() As String
Caption = m_Caption
End Property

After this you could call it like this from a form the usercontrol is placed on:
Me.Caption = UserControl1.Caption

Property Let and Property Set : these property methods are used to set the porperty. Let is used when you pass a variable. Set is used when you pass an object.
Example :

VB Code for Let:
Dim m_Caption As String
Public Property Let Caption(ByVal NewCaption As String)
m_Caption = NewCaption
End Property
After this you could call it like this
UserControl1.Caption = "This is my control!"

VB Code for Set:
Dim m_Picture As IPictureDisp
Public Property Set Caption(ByRef NewPicture As IPictureDisp)
Set m_Picture = NewPicture
End Property
After this you could call it like this
Set UserControl1.Picture = Picture1.Picture

Q. What kind of threading VB6.0 Supports?
Ans - A thread defines a single path of execution in a computer. If application instantiates multiple objects at the same time. Each object could have its own thread, or the application might have a fixed number of threads to use and could manage its objects across these threads.
VB6 having two type of threading known as apartment threading, single threading.

When threads run under the apartment model, the object in each thread is unaware of objects in other threads and has its own separate copy of global data. apartment model is available only for in process.

Managing Threads in ActiveX Controls and In-Process Components
If your application is an in-process component (ActiveX DLL) or an ActiveX control, the client application will control the creation and management of threads. You can specify whether your component supports multiple apartment threading by choosing either Apartment Threaded or Single Threaded from the drop-down box in the Threading Model section under the General tab of the Project, Properties dialog box.
Note - the default setting for in-process and control components is Apartment Threaded.
Finally, you can check the Unattended Execution box on the General tab of the Project, Properties dialog box to ensure that your in-process component is thread-safe.

Managing Threading in Out-of-Process Components
If your application is an out-of-process component (ActiveX EXE), you have three choices for its threading model :
1. A Single thread. When a client makes a request to the component before previous requests have finished processing, the additional request is serialized. A serialized request is placed in a queue behind other requests on the same thread. To make your out-of-process component single-threaded, select the Thread Pool option on the General tab of the Project, Properties dialog box and make sure that the number of threads is one.
Typically, developers choose this option when compiling projects that were created in earlier versions of VB.

2. Round-robin thread assignment to a fixed number of threads. There is an upper limit on the number of threads that the component will support. As additional requests pile up beyond the maximum number of threads, the system moves to the next thread (or cycles back to the first thread if it was already on the least thread), serializing the new request behind other requests on the next thread. To implement round-robin thread assignment, select the Thread Pool option on the General tab of the Project, Properties dialog box, setting the number of threads to a number greater than one. You must also make sure that the project is marked for Unattended Execution. Round-robin threading can actually manage system resources and performance more efficiently than can unlimited threading, because round-robin threading limits the amount of server overhead that will be dedicated to a COM component’s objects.

3. Unlimited threads. A separate new thread will begin for every new object. To implement unlimited thread assignment, select the Thread per Object option on the General tab of the Project, Properties dialog box. You must also make sure that the project is marked for Unattended Execution. Unlimited threads will, of course, guarantee that every new connection to the out-of-process component gets its very own thread and therefore suffers no blockage. The performance of the system as a whole might degrade with a lot of unlimited thread connections, however, because the server will have to provide resources for each thread.


Q. How will you handle errors in Client Server COM?
Ans -
We handle the error at server and then pass that to client also by following any of the below two methods :
1. Let the server’s methods return a result code to the client showing success or failure. This “soft” method of error handling will not generate an error condition in the client. The client can then check the return value of the server’s method to see whether all has gone well.
[Method in the server class]
Public Function MyMethod () as Integer
‘Initialize return value to OK
MyMethod = 0
On Error GoTo MyMethod_Error
‘do stuff that could possibly cause an error
Exit Function

MyMethod_Error:
‘return error code
MyMethod = Err.Number
Resume Next
End Function

[Code in the client application]
Dim iResult as Integer
iResult = MyServer.MyMethod()
‘Check method’s result code for an error
If iResult <> 0 then
‘ do something to handle the error
End If
‘Or - Following line ignores the method’s result code
MyServer.MyMethod

2. Raise an error code in the server that the system can pass backto the client. It generates a hard error condition in the client and forces the client to do its own error handling to deal with the server’s error.
[Method in the server class]
Public Sub MyMethod2 ()
On Error GoTo MyMethod2_Error
. ‘do stuff that could possibly cause an error
Exit Sub
MyMethod2_Error:
‘client will see Err.Number as 1000
Err.Raise 1000 + vbObjectErrorlient
End Sub

[Code in the client application]
On Error GoTo MyCall_Error
MyServer.MyMethod2
Exit Sub
MyCall_Error:
‘ do something to handle the error


Q. How can we implement custom properties in Class Modules?
Ans - You can implement these custom properties either as Public variables of the Class or by using special Property Let/Set and Property Get procedures.
Implementing Properties as Public Variables : A Public variable in a class module automatically implements a property of the class. To add a property called “Name” to a class, you just write the following lines in the General Declarations section of a class module:
Public Name as String

when calling code accesses your class by instantiating an object, you assign a value to property as
objMine.Name = “Geryon”
and can read the property as
MsgBox objMine.Name

The basic advantage of implementing an object property with a Public variable is that it is very easy to do. BUT You can’t create a read-only property, because Public variables are always writable.
You have no way of triggering an automatic action when the property is manipulated (such as hiding an object when a Visible property is set to False). Different simultaneous instances of a class share the same Public variables, and thus cause all sorts of possible confusion in your calling code.

Implementing Properties with Property Procedures:
You can use the special Property procedures instead. To implement the Name property of a class with Get and Let procedures, you put the
code shown as :
[General Declarations section of Class]
Private gstrName As String
[General Code section of Class]
Public Property Let Name(strVal As String)
gstrName = strVal
End Property
Public Property Get Name() As String
Name = gstrName
End Property

this time the variable is a Private variable. This means the variable won’t be visible outside the class. You use it to store the value of the property you are implementing, but code won’t access this variable directly. Instead, Property Let and Get procedures will be the gateway to the property.

Implementing a Read-Only Property : If you would like a property to be read-only for controller code, all you have to do is leave out the Property Let procedure from your class. That way, the controller has no way of writing the property. You can still store the value of the property in a Private variable of the class module. Other parts of your server class can manipulate the property by changing the Private variable, but the controller application can’t change it directly.


Q. What is property bag in VB 6.0?
Ans - In Visual Basic 6.0, the PropertyBag object was used to persist an object's data between instances, allowing you to store values and retrieve them the next time the object was instantiated. Although you could set an object's properties to a default value at design time, any values entered at run time were lost when the object was destroyed. The PropertyBag object allowed a copy of the object to be persisted in a binary format and retrieved for later reuse. For example, a class used to calculate loans might use a PropertyBag to persist an interest rate between instances rather than entering it each time the class is used.


Q. Where i should develop an Activex Exe and where Activex Dll?
Or Where i need to develop an inprocess COM and where out-of-process?
Ans – If i am going to develop some COM server then need to choose Activex EXE(Out of process) because exe is executable that can run on server and listen to clients and if i need to develop some library of code for a my Sever Com Project i can user DLLs.

Q. How to add a test project to your COM Project?
Ans – By File --> Add Project.

Q. How can we implement Custom Events in Class Modules?
Ans - Implementing Custom Events in Class Modules
You can define and fire your own custom-defined events in a class module. The act of firing an event from within the class module’s code is known as raising the event. When an object instantiated from your class raises an event, the controller code can handle that event in an event procedure.

Declaring the Event
You must first define the event by declaring it in the General Declarations section of the class. The syntax is
Public Event EventName (argument list)
where argument list is a list of arguments similar to the parameter list in a regular procedure. for example
Public Event FileFound _
(FileName as String, _
FilePath As String, _
Cancel as Boolean)
Third Boolean parameter is added: Cancel, controller might change this to tell our class object to stop processing

Raising the Event and Implementing Callbacks in a Class Object
To implement an event in a class, is to fire, or raise, the event in a single line of code, typically in a method of the class, with the RaiseEvent keyword. Before firing the event, you will want to prepare the value of the arguments to be passed to the controller, and after the event fires, you will want to check the arguments’ values to see whether the controller has changed any of them. Notice that the code checks the value of the Cancel argument after the event fires to see whether the controller wants this code in our class to continue processing. Because controllers can modify an event’s arguments, this effectively implements callback functionality between controller and object.

. . .code to assign values of strName and strDir
initialize value for
Cancel argument
blnCancel = False
fire the event
RaiseEvent FileFound(strName, strDir, blnCancel)
check to see whether controller
changed the Cancel argument
If blnCancel Then Exit Sub

Built-In Events of Class Modules :
Every Class module comes with two predefined events: Initialize and Terminate.
You can find the event procedure for these two events in the class module’s code window by clicking the Objects drop-down list (left-hand list box at the top of the code window) and choosing the Class object. The Procedures drop-down list (right-hand list box at the top of the code window) then displays the Initialize and Terminate event procedure.

Initialize Event : The Initialize event happens whenever a routine in another part of the application or in an ActiveX client uses your class module to instantiate a new copy of an object.

Terminate Event : The Terminate event happens whenever a routine in another part of the application or in an ActiveX client destroys the object instance of your class module. An object gets destroyed in one of two ways:
. The variable that was used to hold your class module’s object goes out of scope in the calling code.
. The calling code explicitly destroys the object with the syntax
Set Object = Nothing.

Using Public, Private, and Friend : There are three ways of defining the scope of a property or method:
. Public
. Private
. Friend
Public : Public properties and methods are available to other modules in the same project as the class module. They are also available to other projects as properties and methods of an object derived from that class module.
Consider the following, for example:
Public Property Get HireDate() as Date
Public Sub Save()

Private: Private property or method are private to that class module. Only code in that class module can access the property or method. Private methods are typically support routines used by the properties of a class. For example, you may need some helper routines that perform date calculations.
Consider the following, for example:
Private Function NextWorkDay(FromDate as Date) As Date
Private Sub PrintForm(FormName As String)

Friend : Friend property or method are private to the project containing the class module. Code in the same class module as the procedure can access the property or method. Code in other modules in the same project can also access the property or method. This is useful when creating helper classes that should not be used by other programs.
Consider the following, for example:
Friend Sub Load(FileName As String)
Friend Function Save(FileName As String) As Boolean

Q. What is do event and with event?
Ans –
DoEvents – Allows to complete other events.(Yields execution so that the operating system can process other events.)
The DoEvents function returns an Integer representing the number of open forms in stand-alone versions of Visual Basic, such as Visual Basic,
WithEvents is used to handle the events of COM components.
For example, you might declare an instance of an Access Report in a form’s General Declarations with the line:
Private WithEvents RPT As Access.Report

Q. Can we execute multiple sql statements and catch the out put in a single recordset and how?
Ans - ' Open compound recordset
Set rstCompound = New ADODB.Recordset
SQLCompound = "SELECT * FROM Authors; " & _
"SELECT * FROM stores; " & _
"SELECT * FROM jobs"
rstCompound.Open SQLCompound, Cnxn, adOpenStatic, adLockReadOnly, adCmdText

' Display results from each SELECT statement
intCount = 1
Do Until rstCompound Is Nothing
Debug.Print "Contents of recordset #" & intCount

Do Until rstCompound.EOF
Debug.Print , rstCompound.Fields(0), rstCompound.Fields(1)
rstCompound.MoveNext
Loop

Set rstCompound = rstCompound.NextRecordset
intCount = intCount + 1
Loop

Q. How to open a recordset from a procedure in application?
Ans – We can open a record set from a stored procedure if stored procedure have a parameter of type REFCURSOR with mode OUT. Then we need to set the commandtype property as adCmdStoredProc, and then need to set the CommandText property to the stored proc name and then execute the command using set statement for a reocord set like :

mobjCmd.CommandType = adCmdStoredProc
mobjCmd.CommandText = "SelectCustomer"

Add all the input parameters to the commands as below (don't add any parameter for out parameter of type refcur )
set param1 = mobjCmd.CreateParameter("id",adVarChar,adParamInputOutput,,60)
mobjCmd.Parameters.Append param1
Then need to execute the command and set recordset which will collect all the out type of refcursors.(Or if your stored procedure don't have any input parameter then execute it directly.)

Set mobjRst = mobjCmd.Execute

ADO's command object automatically handle the out parameter of refcursor type.


Q. How to get two different result set from a single procedure?
Ans – We can take multiple result set from a stored procedure if stored proc have multiple REFCURSOR with mode OUT. We just need to follow the same as we did for the single out argument.
The record set will collect all the resultset. In the below code the strored proc SelectCustomer having two OUT parameters of type REFCURSOR.

sCmd.CommandText = "SelectCustomer"
sCmd.CommandType = 4 '// 4 is for adCmdStoredProc
set rs = sCmd.Execute
'//We traverse the first result set as
while ....
response.write rs(1)


'// For the next result set we need to execute
set rs = rs.NextRecordset
'// Now we can traverse the next result set but now we can't move on to the previous result set
response.write "<BR>" & rs(3)

Q. How can we get a flag value from a stored proc?
Ans – In the below code the SelectCustomer proc is having an out parameter of varchar2 type

<%
DIM sCmd
DIM sFlag
DIM param1
Dim cnn , rs, value
Set cnn = server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.Recordset")
cnn.Open connstring
SET sCmd =server.CreateObject("ADODB.Command")
SET sCmd.ActiveConnection = cnn
sCmd.CommandText = "SelectCustomer"
sCmd.CommandType = 4
set param1 = sCmd.CreateParameter("val",200,2,60)
sCmd.Parameters.Append param1
sCmd.Execute
sFlag = sCmd.Parameters("val").Value
response.write sflag

%>

Q. Can i create an object of a dll or exe with out registering it? And how?
Ans – Yes i can create an object of com with out registering it. It can be done by browsing the object from project --> reference window and need to choose the com to include in our project.

Q. Can i compile a vb 6.0 project with out a form (standered exe project)?
Ans – Yes we can compile it, but this will require a start up object sub main(). We can set this on project properties.

***** if you want to use a class called MyClass from a component application called MyComp, your variable declaration in a General Declarations section might look like this:
Private objMyClass As New MyComp.MyClass

So the calling is like projectName.ClassName.

Q. What SDLC Model do you follow and what are the steps?
Ans -
Software development life cycle (Waterfall Model)
  1. Requirement Analysis & Definition
  2. System & Software Design
  3. Implementation & Unit Testing
  4. Integration & System Testing
  5. Operations & Maintenance

Q. What steps do you follow while doing Ehnancements or Change?
Requirement Analysis and definition in terms of CBR (Client Business Requirement)
Get Sign off on CBR from Client
Do IMPACT ANALYSIS and prepare IMPACT ANALYSIS DOCUMENT - Contain the solution approach along with the list of CIs needs to be change and the impact of the change through out the application.
some neutral person do IMPACT ANALYSIS REVIEW
Prepare SOW (Statement of Work Document) - SOW “a formal document that captures and defines the work activities, deliverable, and time line.
Do CODE CHECKED OUT
Do CODE CHANGE
Do Code Review
DO IUT (Independent Unit Testing) - Prepare UTP (Unit Test Plan Document) containing positive, negative and exceptional test cases and do testing
Do CODE CHECKED IN
Do SIT (System Integrated Testing)
UAT (User Acceptance Testing)
Prepare Release note - Contains the summary of the change along with the known bugs and limitations if any. This document also contain
1. The release components those should be added or replaced on the production server for example the the asp pages or dlls for front end.
2. Database scripts that needs to be execute on production database schema.
Prepare Check list for the deployment.
Implement on Production

Note – Above work flow is also used for bug fix only difference is that after IUT one additional step is CCB(Change control board) Approval.

Q. What is DLL Hell?
Ans - DLL Hell is a term for the complications that arise when working with dynamic link libraries (DLLs) with Microsoft Windows operating systems of the 16 bit editions where all DLL run in a single memory space. The difficulties can be because of conflicts between DLL versions, difficulty in obtaining required DLLs, and having many unnecessary DLL copies because the 16-bit operating systems did not restrict processes to their own memory space, thereby not allowing them to load their own version of a shared module for which they are compatible.

Q. Is it possible to Run conflicting DLLs simultaneously?
Ans - Yes
An easy manual solution to conflicts was placing the different versions of the problem DLL into the applications' folders, rather than a common system-wide folder. This works in general as long as the application is 32-bit or 64-bit, and that the DLL does not use shared memory. In the case of 16-bit applications, the two applications cannot be executed simultaneously on a 16-bit platform, or in the same 16-bit virtual machine under a 32-bit operating system.

Q. How will you identify a perticular dll is registered or not on the system?
Ans – We can search the registery by
Run->regedit and then Edit--> Find
OR
We can use utilities like VB's Object Browser. From the VB project View-->Object Browser.
This will help you to find out the the methods and properties also.

Q. How will you unregister a dll through front end?
Ans – We can do this by Control Panel-->Administrative Tools-->Component Services
To unregister : right click on Dll or COM -->Delete.
To register : right click on COM + Application -->New application and need to follow the wizard.

Q. What is the difference between CreateObject and GetObject?
Ans - The CreateObject and GetObject functions return a reference to a server class object.
CreateObject always creates a new instance of the server object. Where as GetObject can use a running instance of the server object but can also create a new instance depending on the parameters passed.

Q. How to Instantiate an Object in VB?
Ans – We can instantiate an object by using either New or by CreateObject menthod.

***** An object class belonging to a COM component may contain other classes or class collections. Subclasses or collection elements might repeat this nesting structure and could, in turn, contain other object classes and collections. Only objects in the topmost level of the component’s hierarchy can be created directly with CreateObject().The subordinate objects in the hierarchy either already exist as subobjects of the higher objects or must be created with methods of the higher objects. In ActiveX terminology, the highest-level objects are said to be Public and Creatable, whereas subobjects are Dependent or Public but Not Creatable. For Example in Excel Component hierarchy’s topmost objects is the Application object. So we can create the object of application only like
Set objExcel = CreateObject(“Excel.Application”)
The Excel server contains a Workbook class also and you can't create object of workbook where as you can refer directly this with help of application object like ...
Dim wb As Excel.Workbook
Set wb = objExcel.Workbooks.Add

*****Detecting Whether a Variable Is Instantiated
If Not xl Is Nothing Then
Do some stuff with the xl object
End If

Q. How to handle the events of a COM?
Ans - In order to handle the events of a COM component object instance, you must declare it using the WithEvents keyword. For example, you might declare an instance of an Access Report in a form’s General Declarations with the line:
Private WithEvents RPT As Access.Report

In the Code Window for the form, you’d see RPT listed as one of the form’s objects in left side combo box . If you chose the RPT object from the left side drop-down list, then you’d see the list of procedures for the events supported by this object in the right side drop-down list on the top.

Q. What is an interface? How do you implement interfaces in VB 6.0?
Ans - An interface is a named collection of methods without implementations.
The Interface class provides an abstract definition for the properties and methods of a generic type of object. It does not, however, provide that behavior. Each specific object class that implements the
Interface class must actually provide code for each of the methods and properties of the Interface class.
A VB interface defines a set of methods but does not implement them. A class that implements the interface agrees to implement all of the methods defined in the interface, thereby agreeing to certain behavior.

You can create standard interfaces by compiling abstract classes in Visual Basic ActiveX DLLs or EXEs, or with the MkTypLib utility, included in the Tools directory.


Or you can easily create an interface by Visual Basic class module. Open a new ActiveX DLL or EXE project, and add the desired properties and methods to a class module. Don’t put any code in the procedures. Give the class the name you want the interface to have, for example IFinance, and make the project.
The type library in the resulting .dll or .exe file will contain the information required by the Implements statement. To use it in another project, use the Browse button on the References dialog box to locate the .dll or .exe file and set a reference. You can use the Object Browser to see what interfaces a type library contains.
Visual Basic provides the Implements keyword as the means for incorporating a secondary interface.
The Implements feature does not support outgoing interfaces. Thus, any events you declare in the class module will be ignored.
For example, if your project had a reference to a type library that described the IFinance interface, you could place the following code in a class module:
Implements IFinance
Because type libraries contain only interfaces, and no implementation, you would then add code for each of the properties and methods of the IFinance interface


******* vbObjectError Constant - When you return error information from a class module, you should add a constant
number, vbObjectError (a number in the range of negative two billion on most systems), to your error number before you invoke the Raise
method. You should do this to signal the error is generated in the class object but raised to the calling routine or application.

******ERROR FUNCTION - The Error function has one argument—an error number. It returns a string description of the error corresponding to that number. For example, if you coded the following:
Msgbox Error(61)

Q. If we are using on error resume next and error occored then the resume next will work for frist error only or will work for every line?
Ans – It will work for every line.

Q. What is on error go to 0 and on error resume next?
OR
How do u perform error handling in VB?
Ans – Errors in VB can be handling with following ways :
1. Using the On Error Statement :
The first way to code the On Error statement is as follows:
On Error GoTo Main_Error
where Main_Error is a line label in a procedure.
The sysntax is On Error GoTo <line>

Private Sub Main()
On Error GoTo Main_Error
... some processing ...
Exit Sub
Main_Error
error handling code
End Sub

The second way of coding an On Error statement is with a Resume Next clause. And the syntax is : On Error Resume Next
Resume Next tells Visual Basic that when a runtime error occurs, ignore the statement that caused the error and continue execution
with the next statement.

The last way to code the On Error statement is with the GoTo 0 clause, as in the following:
On Error GoTo 0
This is different from the other On Error statements in that it disables rather than enables error handling for the current routine. Even
if there is a line labeled “0”, error handling will be disabled.

2. Inline Error Handling – For example you may have a procedure that reads information from a file and does some processing, and exits. If the file is not found, you want to exit the routine. If any other error occurs, you want to display a message box.
Private SubA()
set the initial error handling to go to line SubA_Exit
On Error Goto SubA_Exit
Dim sFile as String
sFile = “filename.dat”
do some additional processing
Reset the error handling to go to line SubA_Exit
for the Open statement.
On Error Goto SubA_Exit
Open sFile For Input As #1
Reset to original error handling
On Error Goto SubA_Error
continue processing...
SubA_Exit
Exit Sub
SubA_Error
error handling
End Sub

When "On Error Resume Next" is enabled, the properties of the Err object are automatically populated with details of the errors that have occurred like err.number and err.discription
Methods of Err are :
Clear - this method reinitializes all the Err properties. You can use the Clear method at any time to explicitly reset the Err object. Visual Basic also invokes Clear automatically :
-> When either a Resume or Resume Next statement is encountered.
->At an Exit Sub, Exit Function, or Exit Property statement.
-> Each time an On Error statement is executed.

Raise - is used to generate errors within code. You can use Raise to create your own runtime errors that will be used elsewhere in your application. This method have arguments :
Number, Source, Description, HelpFile, HelpContext
Where the numer is mandatory.


Properties of Err :
Number – this property identifies an error by number. It is set by Visual Basic when a runtime error occurs. It can also be set in code by a developer to identify a user-defined error. The Number property contains a long integer value. range from 0 to 65,535 and VB reserves numbers up through 512 for itself, so the practical range available to you for your own “user-defined” errors is 513-65,535
Description - A brief description of an error is available in the Description property of the Err object. the Err.Description can be set in code.
Source - The Source property of the Err object is a string expression of the location at which the error occurred in your application. If the error occurred in a standard module, the source will be set to the project name. If the error occurred in a class module, Visual Basic
uses the project name and the class module name for the source. the Source property can be set in code.

HelpFile - If you are generating errors within your code and you want to provide additional help—beyond the Err.Description—for the user, you could have a help file associated with the error information. The HelpFile property is a string expression that contains the path and filename of the help file.

HelpContext - The HelpContext property of the Err object defines a help topic within the file identified by the HelpFile property. Together the two can be used to add additional help to a message box when an error is displayed to the user.

LastDLLError - The LastDLLError property is a read-only property used by DLLs to return error information to Visual Basic applications. For versions of Visual Basic prior to 5.0, it is important to know that LastDLLError is only available in 32-bit Windows operating systems. If an error occurs in a DLL, the function or sub-routine will signify the error through a return value or an argument.

Q. What is the difference between Query unload and unload in form?
Occurs before a form or application closes. When an MDIForm object closes, the QueryUnload event occurs first for the MDI form and then in all MDI child forms. If no form cancels the QueryUnload event, the Unload event occurs first in all other forms and then in an MDI form. When a child form or a Form object closes, the QueryUnload event in that form occurs before the form’s Unload event.

Q. What are different types of Locks in VB?
Ans - VBLock Types – are used to maintain DB consistency when multiple user access Database simultaneously.
LockPessimistic - Locks the row immediately upon editing.
LockOptimistic - Locks the row only when Update is called. not when you start editing.
LockBatchOptimistic - Allows Batch Updates. This option is required for client-side cursors.
LockReadOnly(Default) - Read only. Cannot alter the data.

Q. What is the difference between Pessimistic and Optimistic Locking?
Ans - The basic difference between Optimistic and Pessimistic locking is the time at which the lock on a
row or page occurs. A Pessimistic lock is enforced when the row is being edited while an Optimistic
lock occurs at the time the row is being updated. Obviously the time between an Edit and Update can
be very short, but Pessimistic locking will allow the database provider to prevent a user from
overwriting changes to a row by another user that occurred while he was updating it. There is no
provision for this under Optimistic locking and the last user to perform the update wins.

Q. What are different types of Cursors in VB?
Ans - VBCursor Types – are required to process multiple records when we required control over query processing.
Static -- Not detect changes of others. You can move fwd and backward
Dynamic – Reflect the changes of others. You can move fwd and backward. This is most expensive.
Keyset -- Middle of static and dynamic - Generate unique identified key of particular unique column which is called Keyset. You can move fwd and backward. Only updated changes can be detected.
ForwardOnly – Default. Move only fwd no backward. Forward-only cursors create static snapshots of data. ->best performance -> also as firehose cursors.

Q. What is pass ByVal, By Ref, Paramarray?
In ByVal - a copy of the argument is passed to the called module(either function or procedure). Means actual parameters copy in to formal parameters so modifications in formal parameters during the execution, not reflect in actual parameters.
Where as in Byref (default) - a reference to the argument is passed to called module. Means formal parameter also refer to actual parameters, so changes made to the formal parameters reflect to actual parameter because both the formal and actual referrer the same memory area.

ParamArray - Indicate the last parameter. which is optional array of Variant elements. Pass n number of argument to procedure or function
e.g. Private Function Sum(ParamArray PAargs() As Variant) As Single
answer = Sum(1,2,3,4,5...................)

Event - Declares a user-defined event
DoEvents - Allows VB to complete pending tasks

Q. What are arrays in VB?
An array is a consecutive group of memory locations that all have the same name and the same type.

Q. How to declare array in VB?
Dim MyIntArray(10) As Integer
Dim MySingleArray(3 to 5) As Single

Multidimensional arrays
Dim a(1 to 5,1 to 5) As Double -- Not used this multidimensional array

We can declare array by omitting its dimensions in the declaration statement like
Dim MyDynArray() As Long
You must then redimension the array with a ReDim statement before you use it. Like -
ReDim MyDynArray(10)
Each time you execute the ReDim statement, all the values currently stored in the array are lost.
To store previous vaule then use Preserve
ReDim Preserve MyDynArray(12)

Q. What are Collections in VB?
A collection is an ordered set of items that you can refer as a unit. For example Form in vb is collection.

In Array each member should have the same data type, where as item in the collection does not need to have the same data type.
Arrays tend to fixed in size where as collections are dynamic.

Collection has three methods and one property:
Add (Item, Key, Before, After) method: adds items to the collection
Item (Index) method: return an item by index or by key
Remove (Index) method: delete item from collection by index or by key
Count property: return the number of items in the Collection

To use a collection, we need to declare collection variables. Like
Dim myCollection as New Collection
Dim localControls As Collection

Q. What is Marshaling?
Ans. - Interaction between 2 or more process is known as marshaling.
It is typically used when data must be moved between different parts of a program or from one program to another. Generally required in out-of-process execution.

Q. What is default type in Std module and Class module either private or public?
Ans -

Q. What is the difference between Std module and Class module ?
Ans -
The main difference between the standerd and class module is in the way that they handle data. A standard module stores only one copy of the data. A class module encapsulates the data within each instance of the class.
The other main difference is the scope of variables and procedures within the module. In general, any variables and procedures declared as Public within a standard module are visible anywhere in the project or external programs if the standard module is in a component. Variables and procedures declared as Public within a class module can only be seen through a reference to an instance of the class module.
The lifetime of data and procedures stored within a module is affected by which type of module is used. The lifetime of the data and procedures in a class module is defined by the lifetime of the object. So data and procedures are available only if a reference to the object exists. Data and procedures declared within standard modules are available for the lifetime of the program.
Therefore, to answer your question, if you are writing a function that you want available throughout the lifetime of the program and visible to all code in the application, then place the function within a standard module.

Std module – can not create object(single vbp),
class module – can create a object and re-usability(multiple vbp)
Std Module : Only We can use with in the Application (Project)
Class Module : We can use (Outside) other application also by using Instance creation.

Standard module:
1)place for variable declarations,procedures etc. and we can access these procedures in wherever in the project.
2)Available only for the existing modules where they are used.

Class module:
1)Unlike standard module,members of class like object's properties,events can be accessed only whenever an instance of class is created.
2)We can make use of it whenever an object reference of the particular class is created for number of applications

--GUID and what is Interface ID -- GUID(DLL),ClassID(for a class in DLL)
GUID means global unique identification id.

Class modules in a COM component can be classified as:
Service classes. are for internal use by the server itself and are invisible and unusable to clients. So a service class should be private.
Dependent classes. are visible to clients, but clients can only instantiate and manipulate them indirectly through the third type of class, externally creatable classes. So a dependent class should be PublicNotCreatable.
Externally creatable classes. are visible to clients, and clients can instantiate and manipulate their objects directly.

Instancing Property – Controls the behavior of public class out side the project.
whether you can create instances of a public class outside a project, and how it will behave. Not available at run time.
The Instancing property has these settings:
Setting
Description
1
(Default) Private. Other applications aren't allowed access to type library information about the class, and cannot create instances of it. Private objects are only for use within your component.
The Instancing property default varies depending on the project type. Private is the default only for class modules in Standard Exe projects.
When you insert a new class module into an ActiveX Exe project or an ActiveX DLL project, the default value of the Instancing property is MultiUse. When you insert a new class module into an ActiveX Control project, the default value of the Instancing property is PublicNotCreatable.
2
PublicNotCreatable. Other applications can use objects of this class only if your component creates the objects first. Other applications cannot use the CreateObject function or the New operator to create objects from the class.This signifies that an object of this class is visible to a client, but that the client can’t create such an object directly.
3
SingleUse. Allows other applications to create objects from the class, but every object of this class that a client creates starts a new instance of your component. Not allowed in ActiveX DLL projects.
4
GlobalSingleUse. Similar to SingleUse, except that properties and methods of the class can be invoked as if they were simply global functions. Not allowed in ActiveX DLL projects. it is not necessary to declare or instantiate an object variable.
5
MultiUse. Allows other applications to create objects from the class. One instance of your component can provide any number of objects created in this fashion. The first request for a class instance starts the COM component. All subsequent requests are serviced by the already running server.
6
GlobalMultiUse. Similar to MultiUse, with one addition: properties and methods of the class can be invoked as if they were simply global functions. Its not necessary to explicitly create an instance of the class first, because one will automatically be created.


Setting
Applies to Project Type

ActiveX Exe
ActiveX DLL
ActiveX Control
Std. Exe
Private
X
X
X
X
PublicNotCreatable
X
X
X

SingleUse
X



GlobalSingleUse
X



MultiUse
X
X


GlobalMultiUse
X
X





Note : Before you decide to make all your externally creatable classes GlobalSingleUse or GlobalMultiUse, however, consider the drawbacks:
. Client-side code is now more ambiguous and therefore less maintainable.
. It’s easier to confuse multiple instances of global information.
Typically, you will only use GlobalSingleUse when the function a class provides is very, very generic.

Note: The main advantage of a MultiUse server is that it uses less system resources because the ActiveX Manager needs to run fewer copies of it. The main reason to use a SingleUse server is to reduce “blocking” of one client’s use of a method by another client. Blocking can happen when a server is MultiUse and more than one client is trying to call the same code at the same time.

What is the difference between COM and DCOM?
COM is collection of tools which are executed on client side environment.
COM in particular stands for Component Object Model. Under this model, the VB application references one or many components(Compiled in the form of DLL) and uses it to access its functions
DCOM is a Distributed component object Model runs at the given server.
COM objects require installation on the machine from where it is being used and DCOM requires installation on server.
The ideal example in this case would be a Clipart which is used among all office applications, whether its word, excel or power point. So you may say the clipart is a different module which is packed as a different Component and any program may call it to show clips stored in the common repository.
COM+
COM+ is an extension of Component Object Model (COM), Microsoft's strategic building block approach for developing application programs. COM+ is both an object-oriented programming architecture and a set of operating system services.

What is ActiveX and Types of ActiveX Components in VB ?
ActiveX is the standard based on COM, which enable object instantiation and communication with each other in a Windows environment. ActiveX is an extension of the older OLE standard. The main difference between ActiveX and OLE standards is that Microsoft markets ActiveX as a technology for providing Internet-enabled, docucentric computing solutions.
Standard EXE -
ActiveX EXE
ActiveX DLL
ActiveX document
ActiveX Control
DHTML Application
IIS Application (Web Class)

How to register a COM (Activex DLL and EXE).
There are three ways to register:

One is by Setup and deployment wizard

Second is by the command as
ActiveX DLL (In-process)
Register:- regsvr32 <path>\<mycomponent>
Unregister:- regsvr32 -u <path>\<mycomponent>
ActiveX Exe (OutofProcess )
Register:- <path>\<mycomponent> regserver
Unregister:- <path>\<mycomponent> regserver \u

Third one is by the GUI as
Using delete option in Component services option in administrative tool(control panel) you can delete a dll or component and by right clicking and new Application - > you can add new component or dll.

Note : Some times we got error while unregister a dll or exe in that case we need to check the process running for that exe or dll if any then we need to kill those from task manager.

Activex DLL
Activex DLL is a library of code out side the application that can called from application and runs within the main program address space. So calling method is fast. On the first call to the methods defined in dll, it load to memory and available for rest of the calls.

Activex EXE
This runs in a separate process in it’s own memory area. And load in to memory on every call and require marshaling for process communication.

Differences between Activex DLL and EXE?
Advantages of ActiveX Dll
It is in-process and shares its client’s address space, so property and method calls don’t have to be marshaled. This results in much faster performance, since first call to the method loads the dll to memory and available for rest of the calls.
Disadvantages of ActiveX Dll
If an unhandled error occurs it will cause the client process to stop operating because of inprocess execution.

Advantages of ActiveX Exe
1) The component can run as a standalone desktop application, like Microsoft Excel or Microsoft Word, in addition to providing objects.
2)If an error occurs the client processes can continue to operate.

Disadvantages of ActiveX Exe
Generally slower than an ActiveX dll because of marshaling required for process communication.
Need to load in to memory on every call.

Note : One more difference is that the public creatable class can be instantiated either as SingleUse or MultiUse Object for Out of Process where as for inprocess it can be instantiated only as MultiUse Object.

What is a Component?
If you compile an ActiveX dll, it becomes a component.
If you compile an ActiveX Control, it becomes both a component and a control. Component is a general term used to describe code that’s grouped by functionality. More specifically, a component in COM terms is a compiled collection of properties/methods and events. Typically a component is loaded into your project via the References whereas an ActiveX Control is loaded into your project via “components”.

ADODB is a ActiveX dll and ADODC is an ActiveX control

What is a Type Library and what is it’s purpose ?
The type library may represent another Visual Basic project, or any other executable component that exposes a type library. Visual Basic creates type library information for the classes you create, and provides type libraries for the objects it includes, and lets you access the type libraries provided by other applications.

What are the type Compatibility (While creating DLL) ?
Visual Basic’s Version Compatibility feature is a way of enhancing your components while maintaining backward compatibility with programs that were compiled using earlier versions. The Version Compatibility box, located on the Component tab of the Project Properties dialog box, contains three options:
No Compatibility: Each time you compile the component, new type library information is generated, including new class IDs and new interface IDs. There is no relation between versions of a component, and programs compiled to use one version cannot use subsequent versions.
Project Compatibility: Each time you compile the component the type library identifier is kept, so that your test projects can maintain their references to the component project. All class IDs from the previous version are maintained; interface IDs are changed only for classes that are no longer binary-compatible with their earlier counterparts.
Note This is a change in Project Compatibility from Visual Basic 5.0, where all class IDs and interface IDs in the project changed if any one class was no longer binary-compatible.
Important For the purpose of releasing compatible versions of a component, Project Compatibility is the same as No Compatibility.
Binary Compatibility: When you compile the project, if any binary-incompatible changes are detected you will be presented with a warning dialog. If you choose to accept the warning, the component will retain the type library identifier and the class IDs. Interface IDs are changed only for classes that are no longer binary-compatible. This is the same behavior as Project Compatibility. If, however, you choose to ignore the warning, the component will also maintain the interface IDs. This option is only available when the compiler determines that the change was in the procedure ID or signature of a method.
Caution   You should only choose the Ignore button if you are absolutely sure that the changes you have made won't break compatibility. If you aren't absolutely sure, take the safe alternative and choose the Accept button to allow the interface ID's to be changed.
Important   The option to override the compiler's warning represents a change in behavior from Visual Basic 5.0. It is important that you fully understand the implications of incompatible changes before proceeding with this option.

Note:: When people talk about Version Compatibility, they’re usually referring to Binary Compatibility.

What is meant by “Early Binding” and “Late Binding”? Which is better?
Early binding and late binding means the time when we bind an interface’s properties and methods to an object reference (or variable). Early binding uses type library information at design time to reference procedures, while late binding handles this at run time. Late binding handles this by interrogating the reference before each call to insure that it supports a particular method. Since every call to a late bound object actually requires two calls, late binding is much less efficient than early binding.
Except where early binding is not supported (ASP, scripting, etc.), late binding should only be used in very special cases.
Dim a as object --it's late binding because type library information not specified at compile time and the variable can hold any type at the time of execution.
Dim a as integer --it's early binding because we have specified variables data upfront.

Diff bet ADO and RDO?
RDO is Hierarchy model where as ADO is Object model. ADO can access data from both flat files as well as the data bases. I.e., It is encapsulation of DAO, RDO , OLE that is why we call it as OLE-DB Technology.

Diff bet ADO and RDO and DAO?
RDO - Remote Data object - Is Hierarchy model where as ADO is Objectmodel.
ADO - ActiveX data Object - can access data from both flat files and DB.
Access all features of OLE-DB and RDO features.
ADO is the higher-level model for talking to OLE DB.
ADO is faster and should be used at all times if possible.
DAO: Database Access Object
Since both are low level, the other interface protocols, RDO and DAO (sit on top of ODBC) and ADO (sits on top of OLEDB) are designed to allow the VB programmer to interact with the low level components more easily.

What are the objects of ADO?
Objects are Connection, Record Set, Command, Parameter, field, Error, Property.

Vbrun300.dll

Option Base -
When an array is declared by default starting index number is 0. By using this statement the programmer can change the starting index number.

Option Explicit -
Declaring a variable in Visual Basic by default is not must. Due to this by default every variable are considered as Variant hence unnecessary memory wastage.
So if we use Option Explicit on top this will enforce the declaration of variable before use.

Option Private
Option Private Module

Defined types declared at module level, are still available within the project containing the module, but they are not available to other applications or projects.

31

Dim x, y as integer. What is x and y data type?
X as variant and y as integer.

Visual Basic is not supprt Inheritance OOPS Concept

The 3 Difference between data grid and flex grid
1. Data Grid is Editable flexgrid is Diplay only.
2. DBGrid allows full data binding while MSFlexGrid allows read-only binding
3. MSFlex grid is smaller and allows cell merging while Datagrid is larger and
does not allow cell merging

If the CursorLocation property is set to adUseClient then the recordset will be available at client as disconnected recordset, where user can do any changes on it, then using the 'ActiveConnection', we can connect to the database once again and update the modifications. And also need to set activeconnection to nothing for disconnected recordset.

By setting the CursorLocation as adUseServer the recordset is available at server side with active connection, can perform any transaction with the database.

Difference between modal and moduless window?
MODAL forms are forms which require user input before any other actions can be taken place. When showing a modal form, the controls outside this modal form will not take user interaction until the form is closed. MsgBox and InputBox forms are examples of modal forms. To show a form modally, use the syntax:
MyForm.SHOW.vbModal. MDI child forms are always modeless. To show a form modeless, use the syntax:: MyForm.SHOW
What are Benefits of wrapping database calls into MTS transactions?
By using MTS we can ensure atomaticity of transactions in distributed databases. Either complete or rollback.
Database Pooling allows MTS to reuse database connections. Database connections are put to sleep. As opposed to being created and destroyed and are activated upon request.

What two methods are called from the ObjectContext object to inform MTS that the transaction was successful or unsuccessful?
SetComplete and SetAbort.

What is the difference between ANSI and UNICODE strings when passed as arguments to a DLL?
ANSI - one byte for a char UNICODE - two bytes per char - works only on NT

What are the Advantages of disconnected recordsets?
A disconnected Recordset, as its name implies, is a Recordset that lacks a connection.
In order to create a disconnected Recordset two Recordset properties must be set appropriately.
CursorLocation property need to set as adUseClient and the LockType property to set as adLockBatchOptimistic.
rst.LockType = adLockBatchOptimistic
rst.CursorLocation = adUseClient
Set rs.ActiveConnection = connPubs
rs.Open
rs.ActiveConnection = Nothing
--do some processing with disconnected recordset
Set rs.ActiveConnection = connPubs
'UPDATE THE CONNECTION WITH THE RECORDSET'S
'CHANGES
rs.UpdateBatch

Disconnected Recordsets, first available with ADO 2.0.
The collections, properties, and methods of a disconnected Recordset are still available even though the connection is closed. This frees up server resources, given that the number of open connections is limited . So this will increase the scalability of your application.

Controls which do not have events ?
Shape and line don’t support any events; they are strictly for decorative purposes.

What are the Control Categories?
a)Intrinsic controls: There are the controls contained inside the Visual Basic executable file and always appear in the ToolBox.
b)ActiveX controls:
which exist as separate files with a .ocx file. These include controls that are available in all editions of Visual Basic (DataCombo, DataList controls, and so on) and those that are available only in the Professional and Enterprise editions (such as Listview, Toolbar, Animation, and Tabbed Dialog). Many third-party ActiveX controls are also available.
c)Insertable Objects:
such as a Microsoft Excel Worksheet object containing a list of all your company’s employees, or a Microsoft Project Calendar object containing the scheduling information for a project. Since these can
be added to the toolbox, they can be considered controls. Some of these objects also support Automation (formerly called OLE Automation),which allows you to program another application’s objects from within a Visual Basic application.

Difference between Linked Object and Embedded Object?
Embedding objects -
When you embed an object, a copy of the object is inserted into the destination document. There’s no link to the original file. When you change information in the source document, no changes will be reflected in the destination document. The actual data for the object is stored within the destination file. To make changes to the embedded object, double click it and it will launch the original application the source file was in.
Linking objects -
Information is updated when you modify the original source file when you use a linked object. This dynamic updating is very handy for things such as the aforementioned monthly report. You can open up the
Excel spreadsheet that is referenced within your Word document. Make changes to the spreadsheet, close Excel, and when you open your Word document… viola! The changes are already there. If that object is linked to ten other Word files, the changes are already in those ten files, too! actually linking or embedding an object is fast and easy.

Difference between listbox and combo box?
A LISTBOX CONTROL displays a list of items from which the user can select one or more. If the number of items exceeds the number that can be displayed, a scroll bar is automatically added to the ListBox control. A COMBOX CONTROL combines the features of a text box and a list box. This control allows the user to select an item either by typing text into the combo box, or by selecting it from the list.
DIFF::Generally, a combo box is appropriate when there is a list of suggested choices, and a list box is appropriate when you want to limit input to what is on the list. A combo box contains an edit field, so choices not on the list can be typed in this field.

Difference Listindex and Tab index?
LIST INDEX::
Returns or sets the index of the currently selected item in the control. Not available at design time. Default LIST INDEX IS -1 for ComboBox, DirListBox, and DriveListBox controls
TAB INDEX::
Returns or sets thetab order of most objects within their parent form. Visual Basic automatically renumbers the TabIndex of other controls to reflect insertions and deletions. You can make changes at design time using theProperties window or at run time in code. The TabIndex property isn’t affected by the ZOrder method.

Difference Declaration and Instantiation an object?


Draw and explain Sequence Modal of DAO?
Connection,Container, Database, DBEngine, Document, Error, Field, Group, Index Parameter Property, QueryDef, Recordset, Relation, TableDef, User, Workspace

Version |Year |Significant Changes and New Features of Visual Basic?
1 1991 initial release, with drag and drop GUI creation
2 1992 ODBC, object variables
3 1993 Access Engine, OLE 2.0, Crystal Reports, new tools and controls
4 1995 classes, OCXs
5 1997 compiler, ActiveX controls
6 1998 web support, windowless controls, designers, data sources
.NET 2001 XML, SOAP, inheritance, structured exception handling
How can 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. There is no difference to the caller between a call coming from a process on a remote machine and a call coming from another process on the same machine.

How can you force new objects to be created on new threads?
The CreateThread function creates a thread to execute within the virtual address space of the calling process. When you are ready to begin execution on the thread, call the Thread.Start Method.


How does a DCOM component know where to instantiate itself?
To create a remote instance of a script component, call the CreateObject method, passing it the name of the remote computer as a parameter. If the remotable attribute of a script component’s <registration> element has been set to “true,” the script component can be instantiated remotely from another computer using Distributed COM (DCOM).
Both computers must have basic DCOM installed. Note The ability to use CreateObject for instantiating remote script components requires Visual Basic 6.0 or later or VBScript 5.0 or later. The following Visual Basic example shows how to do this on a computer named “myserver”:
Set newS = CreateObject(”Component.MyComponent”, “myserver”)
Note There can be a slight delay when you first instantiate a remote script component while DCOM establishes communication between the computers.
1. You can specify the machine on which you want to create the remote server object in DCOM config (’dcomcnfg’).
2. You can specify the machine name when instantiating the remote server object.
In C you can do this with a call to CoGetClassObject or CoCreateInstanceEx (instead of CoCreateInstance, which does not allow you to specify the name of the machine).
In VB you can specify the name in one of the parameters in the call to CreateObject

What type of multi-threading does VB6 implement?
Apartment model threading

What is Database Connection pooling (relative to MTS)?
This allows MTS to reuse database connections. Database connections are
put to “sleep” As opposed to being created and destroyed and are activated upon request.

What is the tool used to configure the port range and protocols for DCOM communications?
DCOMCONFIG.EXE

Why is it important to use source control software for source code?
Modification history. Code ownership: Multiple people cannot modify the same code at the same time.

What version control systems have you used?
VSS(Visual Source Safe), PVCS(Polytron Version Control System) and currently learning SVN(SubVersion)

Name and define the logical tiers in a traditional 3-tiered architecture?
Presentation logic - front end (HTML, Visual Basic forms)
Business Logic - Applications and components that encapsulate business logic
Data end - databases to
store data

What is the difference between a PictureBox and Image control?
Image Control - Use this to display a picture. Use it over the PictureBox because it takes less operating system resourcesPictureBox- While it can display pictures, it also acts as an area on which you can print text and graphics. Use it for home-grown graphics or print previews.

Under which circumstance does a VB application ignore a Timer event?
When the system is really busy doing something else and when DoEvents is being executed.

What does the NewIndex property return?
Used to retrieve the index of the item most recently added to a ListBox or ComboBox control.

What is the purpose of the ClipControls property on a form or container?
Returns or sets a value that determines whether graphics methods in Paint events repaint the entire object or only newly exposed areas. Also determines whether the Microsoft Windows operating environment creates a clipping region that excludes non-graphical controls contained by the object. Read-only at run time.

What is the purpose of the AutoRedraw property on a form or container?
Setting AutoRedraw to True automatically redraws the output from these methods in a Form object or PictureBox control when, for example, the object is re-sized or redisplayed after being hidden by another object

Have you ever used Collections? Collection Classes?
A collection is a set of Repository objects that are all connected to a common source object via a relationship collection. A collection provides a way to connect a group of dependent objects with an object that ‘contains’ them. For example, an Invoice object might have a collection of LineItem objects.

What kind of components can you use as DCOM servers?
actve-x components, Com

What is the size of the variant data type?
The Variant data type has a numeric storage size of 16 bytes and can contain data up to the range of a Decimal, or a character storage size of 22 bytes (plus string length), and can store any character text.

What is the return type of Instr and Strcmp?
Instr – integer (Numeric position)
Strcmp - integer ( if both the string are equal they result = 0)
Strcmp (Str1, Str2, Comparetype)
Comparing mode = 0 – Binary Comparing(Case sensetivite)
1 – Textual Comparing(Not Case sensetivite)

What is the max size allowed for Msgbox Prompt and Input Box?
1024

Max label caption length. –
2,048
Max Text box length ?(imp)
32,000
Max Control Names length ? (IMP)
255.

Type of Extension in Visual Basic
Frm, bas, cls, res, vbx, ocx, frx, vbp, exe
What is frx?(read from net)
When some controls like grid and third party control placed in our application then it will create frx in run time. It's a kind of binary file to contain the external object information like images etc.

Name some date function?
Dateadd(), Datediff(), Datepart(), Cdate()

What will be the result for 15/4 and 15\4?
15/4 = 3.75 and 15\4 = 3

What is keyword used to compare two objects?
ISOperator – Returns Boolean.

How many procedures are in VB?
function and sub procedures. Function Will return value but a sub procedure wont return values…

What is Mask Edit and why it is used?(read from net)
Control. Restricted data input as well as formatted data output.

Drag and Drop state numbers and functions.
State
0 – Source control is being dragged with the range of a target.
1 – Out of the range of a target.
2 – One positon in the target to another.

What are the type of validation available in VB?(imp)
Field, Form

With in the form we want to check all the text box control are typed or not? How?
For each currentcontrol in controls if typeof currentcontrol is TextBox then end if next

What is control array and How many we can have it with in the form?
Group of control share the same name. Max 32, 767.

What is the default model of the form? And what is it number?
VbModaless – 0 (Zero) – We can able to place another window above this form.

What is MDI form? MDI Styles?
We can have only one MDI form for a project. Multiple Document Interface. This form type is VBModal. We have set the Child property of the forms to True to place forms inside this MDI.
Style availables 1. VbCascade 2. VbTitle Horizontal

How many images can be placed in the image list ?
64

What is Zorder Method?
Object.Zorder = 1 or 0
Place a Specified mdi form or control at the front or back of the z-order with n its Graphical Level.

What is diff between the Generic Variable and Specific Variable?
Generic Variable:Create Object, No need refer the object library.
Specific Variable: Create variable to specific type ex int or string, Need refer the object library.

What are properties available in Clip Board?
No Properties Available. Only the methods they are SetText, GetText, Setdata(), Getformat(), Clear.

What is Tabstrip control? What is the starting Index value? How to locate it?
It is tab control to place our controls with in the form in multiple sheets.
Index starts with 1. And to identify
If Tabstrip1.SelectedItem.Index = 1 Then
…..
End if

Why we use Treeview Control?
To list the hierarchial list of the node objects. Such of files and Directories.

Why we need OLE-Automation? Advantages?
Enables an application to exposes objects and methods to other Applications.
No need to reserve memory. No need to write functions.
Object library that simplify programming tasks. i.e., No need to Object library. (OLB, TLB).

What is Static Variable?
Its Scope will be available through out the life time.

Private Dim x as integer. Is it true?
No. Private cannot be used in front of DIM.

What is Implicit?
When we don't define a variable in vb implicitly it will be declared as variant.

What are the scope of the class?
Public , private, Friend

Can we able to set Instancing properties like Singleuse, GlobalSingleuse to ActiveXDll?
No.

In project properties if we set Unattended what is it mean?
This cannot have user interface. This can be used for the COM creation.

What are the Style Properties of Combo Box?
Simple, Dropdown list – We can type and select.
Dropdown Combo – Only Drop Down.

What are the Style properties of List Box?
Simple –Single Select , Extended. – Multiple Select.

What are the different types of Dialog Box?
Predefined, Custom, User Defined.

What is Parser Bug?
It is difficult to use database objects declared in a module from within a form.

What is the Dll required for running the VB?
Vbrun300.dll

Can We create CGI scripts in VB?
Yes.

How to change the Mouse Pointer?
Screen.MousePointer = VBHourGlass/VBNormal.

How to check the condition in Msgbox?
If(Msgbox(”Do you want to delete this Record”,VbYesNo)=VbYes)Then End if

What is Dataware Control?
Any control bound to Data Control.
Ex:- Textbox, Check Box, Picture Box, Image Control, Label, List box, Combo Box, DB Combo

What are two validate with Data Control?
Data_Validate, Data_Error.

Record set types and Number available in VB?
3. 1- Dynaset, 0 – Table, 2 – Snap Shot.

How can we call Stored procedure of Back End in RDO and ADO ?
In RDO – We can call using RDO Query Objects.
In ADO – We can call using Command Objects.

What is the different between Microsoft ODBC Driver and Oracle OBDC Driver?
Microsoft ODBC driver will support all the methods and properties of Visual Basic. Where as the Oracle not.

What are the Technologies for Accessing Database from Visual Basic?
DAO, RDO, ODBCDIRECT, ADO, ODBC API.

What are the different types of error?
Syntax Errors, Runtime , Logic.

What methods are used for DBGrid in unbound mode?
AddData, EditData, Readdata, WriteData.

How to increase the Date corresponding with month,date,year?
DateSerial(year(Now),Month(Now)+1,1)
Hour, min, sec, month, year, DateSerial, dateadd, datediff, weekday, datevalue, timeserial,timevalue.

The Automation Manager
We register the distributed components under automation manager
on server with autmgr32
on client with racmgr32

When it's time to close all the windows, loop through the collection, like this:
Dim i As Integer
Dim f As Form
For i = 1 To col.Count
Set f = col(i)
f.Visible = False
Set f = Nothing
Next

What is Mixed Cursors?
Static + Keyset

What is FireHouse Cursors?
Forward Only Some time Updateable

What is DBFailError?
Rolls Back updates if any errors Occurs.

What is RdExecDirect?
Bypasses the Creation of a stored procedure to execute the query. Does not apply to Oracle.
RdoParameter Object RdoParameterConstant
Direction RdparamInput
RdparamInputOutput
RdParamOutput
Name
Type
Value



0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home