A: 

Got it by using this code:

Private Enum FormState
    FadeIn
    Pause
    FadeOut
End Enum

Private Sub opacityTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles opacityTimer.Tick
    Select Case CurState
        Case FormState.FadeIn
            Me.Opacity += 0.07

            If Me.Opacity >= 0.8 Then
                Me.opacityTimer.Stop()
                CurState = FormState.Pause
                PreviousInterval = opacityTimer.Interval
                opacityTimer.Interval = howLong
                Me.opacityTimer.Start()
            End If

        Case FormState.Pause
            Me.opacityTimer.Stop()
            CurState = FormState.FadeOut
            opacityTimer.Interval = PreviousInterval
            Me.opacityTimer.Start()

        Case FormState.FadeOut
            Me.Opacity -= 0.08

            If Me.Opacity <= 0 Then
                Me.opacityTimer.Stop()
                Form2.theNumOpened = Form2.theNumOpened - 1 'ADDED
                Me.Close()
                Me.Dispose()
            End If
    End Select
End Sub

:o)

David

StealthRT
A: 

Well no answers yet...

I'll chime in on some bad practices:

  1. Using a DoEvents to loop

  2. Using a "static" variable or property in an unknown "Form2" which seems to belong to none of the forms being used here.

  3. Starting and stopping a timer inside of its own event.

  4. Using Windows API calls to force form order.

I think you have more issues than just "it won't close at the right time." Not really sure where to begin.

Jeremy