473,769 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating Microsoft Application Exception Classes

SS
Hi All,

I am trying to create a simple DBException Class which I want to use in
different apps.

Here is what I am doing:

1. I Created a VB Class
Imports Microsoft.Appli cationBlocks.Ex ceptionManageme nt

Imports System.Data.Sql Client

Public Class DBExceptionPubl isher

Implements IExceptionPubli sher

Private SQL_CONNECTION_ STRING As String = _

"User Id=sqamar;" & _

"Password=passw ord;" & _

"Server=trd-11982;" & _

"DataBase=NX20; "

Public Sub Publish(ByVal exception As System.Exceptio n, _

ByVal additionalInfo As System.Collecti ons.Specialized .NameValueColle ction,
_

ByVal configSettings As System.Collecti ons.Specialized .NameValueColle ction)
_

Implements
Microsoft.Appli cationBlocks.Ex ceptionManageme nt.IExceptionPu blisher.Publish

Dim strConn As String = SQL_CONNECTION_ STRING

Dim scnnFTTP As New SqlConnection(s trConn)

Dim scmd As New SqlCommand("spT estTable", scnnFTTP)

Try

scnnFTTP.Open()

scmd.CommandTyp e = CommandType.Sto redProcedure

With scmd.Parameters

..Add(New SqlParameter("@ paramin", SqlDbType.VarCh ar)).Value = "Hello String"

End With

Dim myReader As SqlDataReader = scmd.ExecuteRea der()

Catch expSQL As SqlException

MessageBox.Show (expSQL.Message ())

End Try

End Sub

End Class

2. Created a app.config file

<?xml version="1.0" encoding="utf-8" ?>

<configuratio n>

<configSections >

<section name="exception Management"
type="Microsoft .ApplicationBlo cks.ExceptionMa nagement.Except ionManagerSecti o
nHandler,Micros oft.Application Blocks.Exceptio nManagement" />

</configSections>

<exceptionManag ement mode="on">

<publisher assembly="VB_Ap p_Test" type="VB_App_Te st.DBExceptionP ublisher" />

</exceptionManage ment>

</configuration>

3. In my VB Form I did:

Try
Dim x As Integer
Dim y As Integer

y = 0
x = 1 / y

Catch ex As Exception
ExceptionManage r.Publish(ex)
End Try

This works fine but when I create another project and reference this dll it
gives me an error:

Argument not specified for parameter 'additionalInfo ' of 'Public Overridable
NotOverridable Sub Publish(excepti on As System.Exceptio n, additionalInfo As
System.Collecti ons.Specialized .NameValueColle ction, configSettings As
System.Collecti ons.Specialized .NameValueColle ction)'.
C:\Documents and Settings\slqama r\My Documents\Visua l Studio
Projects\Except ionManagerTestA pp\Form1.vb(65) : Argument not specified for
parameter 'configSettings ' of 'Public Overridable NotOverridable Sub
Publish(excepti on As System.Exceptio n, additionalInfo As
System.Collecti ons.Specialized .NameValueColle ction, configSettings As
System.Collecti ons.Specialized .NameValueColle ction)'.

PLease can someone tell me what I am doing wrong.

Thx

Sal


Jul 21 '05 #1
0 1425

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3252
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle." exception. The problem is that this exception isn't raised somewhere in a method, so it just shows up, and it causes the application to shut down. Is there anyway how to catch this kinds of exceptions? Can I put somewhere a
15
6750
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use javascript or vbscript it works. I will appreciate any help. I do the following (C#):
0
922
by: SS | last post by:
Hi All, I am trying to create a simple DBException Class which I want to use in different apps. Here is what I am doing: 1. I Created a VB Class Imports Microsoft.ApplicationBlocks.ExceptionManagement
12
3174
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without restarting the application. What I did was to create an AppDomain that loaded the plugins and everything was great, until I tried to pass something else that strings between the domains...
15
2836
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. Everything is the default settings I believe. IIS is running under Local System. In IIS the DefaultAppPool is running under Network Service. Annonymous access uses the account IUSR_JASMINE (machine name is Jasmine).
1
3954
by: Gerhard | last post by:
How can I create a new contact in exchange server from a vb.net web application?
3
1918
by: CharlieC | last post by:
I am writing a windows C# application, and I want to ensure that all exceptions, handled or otherwise, are logged to the local event log. I can do this for the handled exceptions, but I am not sure how to override (?) the system exception such that un-handled exceptions are logged. I know that you can do this in delphi by pointing the application exception to your own base exception handler. Is there any similar way that this can be done...
2
3981
by: astolpho | last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output: D:\original\CaseStudy-2-5\CaseStudy\Day02\exercise>asant database Buildfile: build.xml env-user: prop-user: set-user:
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.