Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why Doesn't Add / Remove seem to work?
Message
From
20/12/2004 12:12:39
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Why Doesn't Add / Remove seem to work?
Environment versions
Environment:
C# 1.1
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
00970712
Message ID:
00970712
Views:
61
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,
-=Gary
Next
Reply
Map
View

Click here to load this message in the networking platform