Click here to Skip to main content
13,151,514 members (47,259 online)
Rate this:
Please Sign up or sign in to vote.
See more:
below code gives me error at the line marked says "'object.GetType()' is a 'method', which is not valid in the given context" plz any one can help me out.

System.Reflection.PropertyInfo Imageproperty = default(System.Reflection.PropertyInfo);
Imageproperty = flowLayoutPanel1.GetType.GetProperty("Image", typeof(Image));
if (Imageproperty == null)
Bitmap imgNew = new Bitmap(flowLayoutPanel1.Width, flowLayoutPanel1.Height);
flowLayoutPanel1.DrawToBitmap(imgNew, flowLayoutPanel1.ClientRectangle);
return imgNew;
return (Image)Imageproperty.GetValue(flowLayoutPanel1, null);
Posted 4-Nov-12 18:58pm
Rohan Leuva 5-Nov-12 1:16am
you guy a computer genius..!!!!!!!!!!by the way truely helps me and works fine now.
You are very welcome.
Good luck, call again.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Add round brackets to GetType.

First line it totally pointless, merge it with second one. The idea of getting a property is bad, not good for maintenance. What is you misspell it? Compiler won't detect the bug. The purpose of all this is not clear. I seriously suspect it does not make sense.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170924.2 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100