Device' cannot be converted to 'System.IntPtr'


New member
Oct 17, 2008
Programming Experience
I have a bit of a problem with programming sprites with According to the documentation from MS, there are three overloaded constructors:

Sprite.Sprite Constructor ()
Initializes a new instance of the Sprite class.
Overload List
public Sprite(Device);

public Sprite(ID3DXSprite);

public Sprite(IntPtr);

However, when I try to create a sprite with a Device I get an error :

Error 5 Value of type 'Microsoft.DirectX.DirectDraw.Device' cannot be converted to 'System.IntPtr'.

It’s as if the compiler knows of only one constructor.

Here’s the code:

Dim device As Device
Dim sprite As Direct3D.Sprite

device = New Device()
sprite = New Direct3D.Sprite(device)

I'm using MS visual studio 2008 under vista.

Have I done something silly? Can some explain why I get the error and how I can fix this?

Top Bottom