C# fluent.toc basic programming help

Posted on 2007-10-17
Last Modified: 2013-12-17
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);
        protected void  OnMessage(object sender, MessageEventArgs e)
            System.Console.WriteLine("{0}: {1}",e.From, e.Message);

Question by:tstuardo
    LVL 22

    Expert Comment

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

    LVL 1

    Author Comment

    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)'
    LVL 96

    Accepted Solution

    tc.Message += OnMessage;

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

    LVL 1

    Author Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now