C# fluent.toc basic programming help

I am trying to use the fluent.toc library and  when i try to use the easiest sample code from their web site to test receiving a message (see below)
did anyone ever use this library...does this error make any sense?

i get the following error message

:Error      1      'Fluent.Toc.MessageEventHandler' is a 'type' but is used like a 'variable'      C:\Documents and Settings\damien\My Documents\Visual Studio 2005\Projects\JCIMBot\JCIMBot\Program.cs      23      27      JCIMBot



using System;
using System.Collections.Generic;
using System.Text;
using Fluent.Toc;


namespace JCIMBot
{
    class Program
    {
        static void Main(string[] args)
        {
            TocClient tc = new TocClient();
            tc.Message += MessageEventHandler(OnMessage);
            tc.SignOn("me","mypassword");
            tc.StartListening();
            System.Threading.Thread.Sleep(100000);
            tc.SignOff();
        }
        protected void  OnMessage(object sender, MessageEventArgs e)
        {
            System.Console.WriteLine("{0}: {1}",e.From, e.Message);
        }

       
    }
}
LVL 1
tstuardoAsked:
Who is Participating?
 
Bob LearnedCommented:
tc.Message += OnMessage;

protected static void OnMessage(object sender, MessageEventArgs e)
        {
            System.Console.WriteLine("{0}: {1}",e.From, e.Message);
        }

Bob
0
 
JimBrandleyCommented:
Try this instead:
 tc.Message += new MessageEventHandler(OnMessage);

Jim
0
 
tstuardoAuthor Commented:
i had tried that already
here is the error
Error      1      An object reference is required for the nonstatic field, method, or property 'JCIMBot.Program.OnMessage(object, Fluent.Toc.MessageEventArgs)'
0
 
tstuardoAuthor Commented:
thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.