A
--== Alain ==--
Hi,
I'm creating my own .NET control and i would like to allow user to
allocate an image as property.
for that i used the following code :
#pragma region public Property : ImageSortAscendant
// Allow user to select the image which will be displayed for column
sorted ascendantly
[Description("Set image (8x8) to represent ascending sorting which will
appear onto sorted column header")]
[CategoryAttribute("Appearance")]
property Image^ ImageSortAscendant
{
Image^ get()
{
return m_ImageSortA;
}
void set(Image^ value)
{
if(value->Height == 8 && value->Width == 8)
{
m_ImageSortA = value;
}
}
}
#pragma endregion
However, i have a stupid runtime error.
"An unhandled exception of type 'System.NullReferenceException' occurred
in System.Drawing.dll
Additional information: Object reference not set to an instance of an
object."
so i do not have any instance of my object...but about which object ?
because this error occurs on line ==> if(value->Height == 8 &&
value->Width == 8)
therefore i suppose that it is relative to value object which is not
instanciated as Image ^value = gcnew Image();
however, i've never seen in any book instanciation for such thing at
this stage of component.
please, could you tell me what to do ?
thx.
Al.
I'm creating my own .NET control and i would like to allow user to
allocate an image as property.
for that i used the following code :
#pragma region public Property : ImageSortAscendant
// Allow user to select the image which will be displayed for column
sorted ascendantly
[Description("Set image (8x8) to represent ascending sorting which will
appear onto sorted column header")]
[CategoryAttribute("Appearance")]
property Image^ ImageSortAscendant
{
Image^ get()
{
return m_ImageSortA;
}
void set(Image^ value)
{
if(value->Height == 8 && value->Width == 8)
{
m_ImageSortA = value;
}
}
}
#pragma endregion
However, i have a stupid runtime error.
"An unhandled exception of type 'System.NullReferenceException' occurred
in System.Drawing.dll
Additional information: Object reference not set to an instance of an
object."
so i do not have any instance of my object...but about which object ?
because this error occurs on line ==> if(value->Height == 8 &&
value->Width == 8)
therefore i suppose that it is relative to value object which is not
instanciated as Image ^value = gcnew Image();
however, i've never seen in any book instanciation for such thing at
this stage of component.
please, could you tell me what to do ?
thx.
Al.