As an introduction to XNA, I'm trying out the ViewPort code Jenner kindly posted in this thread (post #11) on the VB.Net forum.

When I resize the viewport (e.g. by resizing the parent form on which the viewport is anchored to 3 sides) the device reset fails with an "Unknown Error". It doesn't necessarily happen the first time the Resized event fires but generally within three times. I can't see anything in the stack trace that explains the problem; everything looks as expected up to the reset. The reset code, which is called from the control's Resize or SizeChanged event, is as follows:

Code:
   Private Sub ResetGraphicsDevice()
        If gDevice Is Nothing OrElse Me.Width = 0 OrElse Me.Height = 0 Then Return
            gDevice.PresentationParameters.BackBufferWidth = Me.Width
            gDevice.PresentationParameters.BackBufferHeight = Me.Height
        Try
            gDevice.Reset()
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
    End Sub
Any ideas?

BB