|
-
July 31st, 2008, 02:04 AM
#1
How to display a message box, if any dll is missing in bin directory
IDE : VS 2005 VISUALBASIC.NET, Platform : .NET 2.0,
Hi,
In my project, i have many dll file in the bin directory. If any dll is deleted or missing. which is required by the project. Then it shows the below two message boxes.
1. Exception has been thrown by the target of an invocation.
2. Object variable or With block variable not set.
I need to give a custom MessageBox by specifying the name of the dll missing like "ActiveImage.Dll is missing, Please contact support" instead of the above two MessageBoxes. How to solve this. Thanks for any support.
Thanks and Regards,
V.Chock.
Last edited by itchock; July 31st, 2008 at 02:07 AM.
Reason: Change the Icon
-
July 31st, 2008, 02:38 AM
#2
Re: How to display a message box, if any dll is missing in bin directory
In the code, you need to catch the exceptions (example code below). If you've got losts of code, I might consider doing a check at the initialisation of the program by call some method from each of the DLLs.
Code:
Try
'Main Code Here
x = 1 / 0
Catch ex as Exception
MsgBox("Oh Dear! An Error" & vbNewLine & "Error Info: " & ex.Message)
End Try
*EDIT*: I've just discovered that 1 / 0 does not result in an error. That's, actually, really annoying, as (strictly speaking) the answer it gives could be wrong.
Last edited by javajawa; July 31st, 2008 at 02:41 AM.
Help from me is always guaranteed!*
VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.
*Guarantee may not be honoured.
-
July 31st, 2008, 02:53 AM
#3
Re: How to display a message box, if any dll is missing in bin directory
 Originally Posted by javajawa
*EDIT*: I've just discovered that 1 / 0 does not result in an error. That's, actually, really annoying, as (strictly speaking) the answer it gives could be wrong.
Interesting... I remember in the old dos days a system would Halt on 1/0. I actually lost a program due to such an error in a basic program. Turned out to be a misspelled variable name in a division statement that triggered the div by 0 error and afterwards what used to be several k in code was 14 bytes with only part of the first comment remaining. Luckily I had a recent backup.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|