Searching for "Instantiate"

Q:

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

Answer

Dim obj as OBJ.CLASS with eitherSet obj = New OBJ.CLASS orSet obj = CreateObject(OBJ.CLASS?) orSet obj = GetObject( , OBJ.CLASS?)orDim obj as New OBJ.CLASS 

Report Error

View answer Workspace Report Error Discuss

Q:

You use Visual Studio .NET to create an assembly, called XYZAssembly, that will be used by other applications, including a standard COM client application.


You must deploy your assembly on the COM application to a client computer. You must ensure that the COM application can instantiate components within the assembly as COM components.

What should you do?

A) Create a strong name of the assembly by using the Strong Name tool (Sn.exe). B) Generate a type library for the assembly by using the Type Library Importer (Tlbimp.exe). Register the file on the client computer.
C) Generate a registry file for the assembly by using the Assembly Registration tool (Regasm.exe) Register the file on the client computer. D) Deploy the assembly to the global assembly cache on the client computer. Add a reference to the assembly in the COM client application.
 
Answer & Explanation Answer: C) Generate a registry file for the assembly by using the Assembly Registration tool (Regasm.exe) Register the file on the client computer.

Explanation:

The Assembly Registration tool reads the metadata within an assembly and adds the necessary entries to the registry, which allows COM clients to create .NET Framework classes transparently. Once a class is registered, any COM client can use it as though the class were a COM class..

 

Incorrect Answers:

Option A:
The Strong Name tool helps sign assemblies with strong names.


Option B:
The Type Library Importer, tlbimp.exe, converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly. It would not be useful in this scenario however.


Option D:
This would not allow the COM application to use the class.

Report Error

View Answer Report Error Discuss