Check if libraries or program exist

  • Thread starter Thread starter Freddy Coal
  • Start date Start date
F

Freddy Coal

Hi, I would like know if something libraries or programs exist, and send
error with a description if the program don't find the libraries, how can
make that?.

For example:

In the use of interop libraries of Office, I declare that libraries in the
begin of code:

Imports Microsoft.Office.Interop

But when the user don't have that libraries, the program don't run
(inmediate crash, they don't start), and the user never know the failure
point.

Thanks in advance for any help.

Freddy Coal
 
Hi, I would like know if something libraries or programs exist, and send
error with a description if the program don't find the libraries, how can
make that?.

For example:

In the use of interop libraries of Office, I declare that libraries in the
begin of code:

Imports Microsoft.Office.Interop

But when the user don't have that libraries, the program don't run
(inmediate crash, they don't start), and the user never know the failure
point.

Thanks in advance for any help.

Freddy Coal

I believe if you use ClickOnce deployment you can set prerequisites
that must be installed with the application. If they do not exist (and
can't be downloaded) a more descriptive error message will be shown to
the user.

Also, I don't believe the program should crash until it tries to
reference the missing library. If that's true, you should be able to
use a simple try...catch block to handle the errors and display a more
helpful error message.

Thanks,

Seth Rowe
 
Seth, How put external programs like prerequisites with ClickOnce?. The Try
cath, only work inside class, I have global variables, exist a way to put
external Try Catch?.

For example, I have this code:

'--------------------
Imports EARTHLib

Public Class FC_Form

Dim camara As New CameraInfoGE
Dim GEarth As New EARTHLib.ApplicationGE

Private Sub FC_Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
'---------------------

In the code I'm using Google Earth, but if the user don't have the
application, the program crash, the program don't start.

Thanks in advance for your help.

Freddy Coal.
 
Freddy Coal said:
Seth, How put external programs like prerequisites with ClickOnce?.
The Try cath, only work inside class, I have global variables, exist
a way to put external Try Catch?.

For example, I have this code:

'--------------------
Imports EARTHLib

Public Class FC_Form

Dim camara As New CameraInfoGE
Dim GEarth As New EARTHLib.ApplicationGE

Private Sub FC_Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
'---------------------

In the code I'm using Google Earth, but if the user don't have the
application, the program crash, the program don't start.

Dim camara As CameraInfoGE
Dim GEarth As EARTHLib.ApplicationGE

Sub New
try
camara =new CameraInfoGE
GEarth =new EARTHLib.ApplicationGE
catch ex as exception
'handle exception
end try
end sub



Armin
 
Seth, How put external programs like prerequisites with ClickOnce?. The Try
cath, only work inside class, I have global variables, exist a way to put
external Try Catch?.

For example, I have this code:

'--------------------
Imports EARTHLib

Public Class FC_Form

Dim camara As New CameraInfoGE
Dim GEarth As New EARTHLib.ApplicationGE

Private Sub FC_Form_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
'---------------------

In the code I'm using Google Earth, but if the user don't have the
application, the program crash, the program don't start.

Thanks in advance for your help.

Freddy Coal.

To be honest, I've only used ClickOnce prerequisites for Microsoft
products like Office and Sql Server, and never any third party
libraries. You best bet is to search Google or MSDN and try to find
some instructions. Armin has already shown you how to properly
instantiate the "unstable" code, so you might not need to worry about
the prereq's if it does what you require.

Thanks,

Seth Rowe
 
Back
Top