[thelist] question concerning c# dynamically changing whatisina picturebox

Chris at globet.com Chris at globet.com
Tue Aug 15 11:21:39 CDT 2006



> >> pbxFloor0.BackgroundImage = 
> >> myElevator.CloseElevatorDoor(i).ToString();
> >>
> >> where pbxFloor0 is a picture box, and
> >> myElevator.CloseElevatorDoor(i).ToString() returns an image name.
> >>
> >> The error message says "BackgroundImage denotes a property where a 
> >> method was expected".
> >>
> >> I tried to hardcode the image name, and got the sqame message.
> >>
> >> What am I doing wrong?

If you get the same error when you hardcode the value, you know that bad
input is not causing the problem. Taking a look at the error message, it
seemss to tell you two things: you are using BackgroundImage as a
property, and BackgroundImage is actually a method. This may mean that
either the declaration of BackgroundImage is incorrect, or your usage of
it is incorrect. Did you produce the custom class yourself? If so, take
a look at your declaration of BackgroundImage. If not, look at the
documentation for the usage of BackgroundImage. Post the code, if you're
in any doubt.


Chris Marsh
Software Developer
t: +44 20 8246 4804 x828
f: +44 20 8246 4808
e: chris at globet.com
w: http://www.globet.com/

Any opinions expressed in this email are those of the individual and not
necessarily the Company. This message is intended for the use of the
individual or entity to which it is addressed and may contain
information that is confidential and privileged and exempt from
disclosure under applicable law. If the reader of this message is not
the intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly prohibited.
If you have received this communication in error, please contact the
sender immediately and delete it from your system. 

More information about the thelist mailing list