Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why Doesn't Add / Remove seem to work?
Message
De
22/12/2004 13:47:03
 
 
À
20/12/2004 12:12:39
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 1.1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00970712
Message ID:
00971536
Vues:
18
Gary,

This is strange ... I get no compiler errors at all. Are you using VS 2002 or 2003? I'm using VS 2003.

~~Bonnie


>Hi,
>
>Using the following code :-
>
>
>using System;
>using System.Drawing;
>using System.Collections;
>using System.ComponentModel;
>using System.Windows.Forms;
>using System.Data;
>
>namespace TestFormApplication
>{
>	/// <summary>
>	/// Summary description for Form1.
>	/// </summary>
>	public class Form1 : System.Windows.Forms.Form
>	{
>		private System.Windows.Forms.TextBox textBox1;
>		private System.Windows.Forms.Label label1;
>		private System.Windows.Forms.Button _btnGo;
>		/// <summary>
>		/// Required designer variable.
>		/// </summary>
>		private System.ComponentModel.Container components = null;
>
>		private Hashtable _hash = new Hashtable();
>		public delegate void GaryDelegate(string message);
>		public event GaryDelegate Hey
>		{	
>			add
>			{
>				_hash["Hey"] = (GaryDelegate) _hash["Hey"] + value;
>
>			}
>			remove
>			{
>				_hash["Hey"] = (GaryDelegate) _hash["Hey"] - value;
>			}
>		}
>
>...
>...
>...
>
>
>
>I get the following compiler error :-
>
>C:\Documents and Settings\Gary.Wynne\My Documents\Visual Studio Projects\TestFormApplication\TestFormApplication\Form1.cs(140): The event 'TestFormApplication.Form1.Hey' can only appear on the left hand side of += or -=
>
>I cannot see anything wrong with this but the compiler doesn't like it <s>.
>
>Any ideas.
>
>Thanks,
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform