a question about oblects

G

gael

I am wrinting a dll (its actually a directx 9
application).
I have an object that is called ourRenderTarget. This
object can be either a windows form or a pictureBox.

I declared the object ourRenderTarget this way:
public object ourRenderTarget;

the problem is that in my code, i use things like

if (ourRenderTarget is System.Windows.Forms.Form)
{ ourRenderTarget.Close(); }

Note that the close function exist only for windows forms
and not for pictureBoxes.

When I try to compile, i get an error:
objet does not contain a definition for Close.

I know that i have to initialize the object
ourRenderTarger. I want an application that uses my dll
to initialize ourRendertarget. I dont want to initialize
it in my dll code. What can I do?
 
R

Rob Teixeira [MVP]

The interface for the Type "object" does not contain the method Close.
Cast the object to Form before calling Close.

-Rob Teixeira [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top