I got this error for the 3rd part of the Begin Game Dev series:

Microsoft.DirectX.Direct3D.InvalidCallException was unhandled
  Message="Error in the application."
  Source="Microsoft.DirectX.Direct3D"
  ErrorCode=-2005530516
  ErrorString="D3DERR_INVALIDCALL".............

after a day of head scratching and moving things about to see what effects they had I fixed it by moving this line of code:

device.VertexFormat = CustomVertex.PositionColored.Format;

to above this line:


device.DrawUserPrimitives(PrimitiveType.LineStrip, 6, CreateCrossHairVertexArrayTop());


rather than below the DrawUserPrimitives as I seemed to think whilst reading the tutorial

Everything else I did as told and I used Visual Studio Express with the SP1 and the Aug2006 Direct SDK and it seems to work fine.

I understand the issue as you have to define a pipeline before you draw the arrays?

PS Hello to everyone