typeof(Image)
hello, i'm trying to check if a cell in datagridview is of type Image with the following code
if(cell.Value.GetType()==typeof(Image))
{
......
......
}
but it's always showing "Object reference not set to an instance of an object" error..could anytell me if i'm doing this right?? If not, how do we check if the cell contains objects of image type??
Related Article: C# image varification (brightness)
is a C# discussion thread by hallmat that has 2 replies, was last updated 1 year ago and has been tagged with the keywords: c#, image, image-processing, program.
cool_zephyr
Junior Poster in Training
84 posts since Apr 2009
Reputation Points: 5
Solved Threads: 10
Skill Endorsements: 0
Did you set the column to be type of Image in the 1st place?
Mitja Bonca
Posting Maven
2,561 posts since May 2009
Reputation Points: 642
Solved Threads: 486
Skill Endorsements: 13
Seems like there is not a value in the cell, thus the object reference error. Debug and verify there is a value there.
Also Mitja's response is important as well.
jbrock31
Junior Poster in Training
79 posts since Oct 2008
Reputation Points: 22
Solved Threads: 16
Skill Endorsements: 0
thank you guys..after all there was no value in the cell..i've been able to fix the problem now
cool_zephyr
Junior Poster in Training
84 posts since Apr 2009
Reputation Points: 5
Solved Threads: 10
Skill Endorsements: 0
Question Answered as of 1 Year Ago by
skatamatic,
jbrock31
and
Mitja Bonca