when i did some testing with our VB6 activex app ( a verry long time ago
:-) )
i was told to do it like this
'Import Reflection Namspace which supports COM interoperability
Imports System.Reflection
private HBSObject as object
in the method to start the component
Dim HBSCOM As Type
'Get the object
HBSCOM = Type.GetTypeFromProgID("Hbase.clsHbase")
'Create instance of HBSCOM
Addtekst("Creating instance ")
HBSObject = Activator.CreateInstance(HBSCOM)
If Not (HBSObject Is Nothing) Then
do your stuff here
End If
in the close / cleanup method
System.Runtime.InteropServices.Marshal.ReleaseComO bject(HBSObject)
HBSObject = Nothing
regards
Michel Posseth [MCP]
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eB**************@tk2msftngp13.phx.gbl...
"Pauras Desani" <Pa***********@gmail.com> schrieb: VB6
Dim cat as Object
Set cat =GetObject("","ABC.Application")
Dot NET
Dim cat as Object
Set cat =GetObject("","ABC.Application")
I don't have deep knowledge of Dot NET so I use this code and its
working.
It runs smoothly when the application is running. But in VB6 if the
application is not working then it shows an error "ActiveX component
can not create object". But in Dot NET I don't get this error
message?. But I need the error message so that I can find out whether
the application is working or not?
Untested:
\\\
Dim cat As Object = GetObject(...)
If cat Is Nothing Then
MsgBox("Application not working!")
Else
...
End If
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>