.NET 2.0: calling an event with a statement

  • Thread starter Thread starter R.A.M.
  • Start date Start date
R

R.A.M.

Helo,
(Sorry for my English...)
Could you help me please with a simpel problem? I am new to C# and I
cannot find solution in MSDN.

I would like to call an event (Login.Authenticate) using a statement
(in a method of Page-derived class). I tried this way:

public partial class DefaultPage : System.Web.UI.Page
{
class DemoLogin : Login
{
....
}
private DemoLogin login;
....
public void DotNet_Click(object sender, EventArgs e)
{
if (login != null)
login.Authenticate(this, e); // HERE
}
....
}

but it cannot be compiled. Could you help me please?
Thank you very much!

/RAM/
 
Only the class that owns / declares an event can trigger it. If you
want your class to allow outsiders to trigger an event, supply a public
method that in turn fires the event.

Michael Lang
XQuiSoft LLC
http://www.xquisoft.com/
 
Back
Top