Object reference not set to an instance of an object.

The following piece of code is causing this error...

this.ImageMap.MouseDown += new MouseButtonEventHandler(this.ImageMap_MouseDown);

can anyone help me?

[163 byte] By [Kimme] at [2007-12-18]
# 1
Check if this.ImageMap is not null.
KonstantinGonikman at 2007-9-8 > top of Msdn Tech,Visual C#,Visual C# Language...
# 2

Konstantin is correct. This error (NullReferenceException) occurs when you attempt to access a member (properties, events, methods, etc) on an variable that does not have a value (instance) associated with it (ie the value is null).

DavidM.Kean-MSFT at 2007-9-8 > top of Msdn Tech,Visual C#,Visual C# Language...
# 3

please check whether u have created the ImageMap object using new.

iamunmad at 2007-9-8 > top of Msdn Tech,Visual C#,Visual C# Language...