|
-
Jul 22nd, 2010, 04:19 PM
#1
Thread Starter
Hyperactive Member
Very hard time with Events and Null
Hello All, I am new to C# (migrated from VB.net) and I am having a REAL hard time creating events in a DLL
Your help is really appreciated.
So I have a class in my DLL that has an event. (See below)
C# Code:
public delegate void ErrorOccuredEventHandler(object sender, clsCollections.ErrorOBject e);
public class clsDBConnection
{
public event ErrorOccuredEventHandler ErrorOccured;
protected virtual void OnErrorOccured(clsCollections.ErrorOBject e)
{
if (this.ErrorOccured != null)
{
this.ErrorOccured(this, e);
}
}
private void ProcessError(string Reason, string ErrorMessage)
{
clsCollections.ErrorOBject NewLogMessage = new clsCollections.ErrorOBject();
NewLogMessage.ErrorCause = Reason;
NewLogMessage.ErrorMessage = ErrorMessage;
this.OnErrorOccured(NewLogMessage);
}
Without fail "Error Occured" is ALWAYS null... I dont understand why this is happening, can SOMEONE please help, I am seriously frustrated and have probably spent a good 5 hrs trying to figure this out (and now feeling kinda stupid)
I hit up an article on MSDN about raising events that I found here on the forums, but I am still clearly missing something because even though I feel like i am following the directions it is still not working 
Thanks in advance!
"I dont even see the code anymore... I just see Blonde, Brunette, Redhead..."
-
Jul 22nd, 2010, 05:50 PM
#2
Thread Starter
Hyperactive Member
[Resolved] Re: Very hard time with Events and Null
I fixed the problem
I did not realize that my constructor was not firing due to a spelling error on my part.
Thanks for reading anyway!
"I dont even see the code anymore... I just see Blonde, Brunette, Redhead..."
-
Jul 22nd, 2010, 10:26 PM
#3
Re: Very hard time with Events and Null
Please mark your thread Resolved if the issue is in fact resolved. You've simply put [Resolved] in the title of your second post, but that doesn't show in the forum thread listing. Use the Thread Tools menu.
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
|