hi thanks for your reply...
"Page Brooks" wrote:
> Calderara,
> Try something like this:
>
> class Program
> {
>
> static void Main(string[] args)
>
> {
>
> MyClass mc = new MyClass();
>
> mc.StartupComplete += new MyClass.dg_Startup(mc_StartupComplete);
>
> mc.Start();
>
> }
>
> static void mc_StartupComplete()
>
> {
>
> Console.WriteLine("Startup Complete");
>
> }
>
> }
>
>
> ....
> ....
> ....
>
> public class MyClass
> {
>
> public delegate void dg_Startup();
>
> public event dg_Startup StartupComplete;
>
> public void Start()
>
> {
>
> if (StartupComplete != null)
>
> StartupComplete();
>
> }
>
> }
>
> ....
>
>
>
> --
> Page Brooks
>
www.explosivedog.com >
>
> "calderara" <calderara@discussions.microsoft.com> wrote in message
> news:D57DF004-540D-45DA-A295-4955F7D38642@microsoft.com...
> > Dear all,
> >
> > Until now I was programing for more that 6 years using VB.net simply
> > because
> > I come from that word and used to. Now I need to switch to C# simply
> > because
> > my customer want its project in that language. So now I am fighting with
> > so
> > simple thing like raising a simple event as follow, and have a complie
> > error,
> > with no damn idea what this compiler want.
> >
> > The code is as follow
> >
> > ------>
> >
> > namespace ConsoleApplication1
> > {
> > public delegate void dg_Startup();
> >
> > class Program
> > {
> >
> > public event dg_Startup StartupComplete;
> >
> > static void Main(string[] args)
> > {
> > Console.WriteLine("Initiliastion");
> > Console.Write("completetd...");
> > StartupComplete;
> > Console.ReadLine;
> > }
> >
> > }
> >
> > }
> > <-------
> >
> > The two last line of my main are highligtied with error saying :
> >
> > Error 1 Only assignment, call, increment, decrement, and new object
> > expressions can be used as a statement D:\Users\Serge\Documents\Visual
> > Studio
> > 2005\Projects\WindowsService1\ConsoleApplication1\Program.cs 18 10
> > ConsoleApplication1
> >
> > Error 2 An object reference is required for the nonstatic field, method,
> > or
> > property
> > 'ConsoleApplication1.Program.StartupComplete'
> > D:\Users\Serge\Documents\Visual
> > Studio
> > 2005\Projects\WindowsService1\ConsoleApplication1\Program.cs 18 10
> > ConsoleApplication1
> >
> > Thnaksa for help
> > serge
>
>