Thanks for the fast reply. I've checked, where this error exactly occurs:
1. Setting a breakpoint on Me.Close()
2. It jumps into this sub:
Code:
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Dim i As Integer = Me.Pages.Count - 1
RaiseEvent NextButton_Clicked(CType(Me.Pages(Me.SelectedIndex), WizardPage).IsLastPage)
If Me.SelectedIndex < i Then
Me.SelectedIndex += 1
End If
End Sub
3. SelectedIndex is -1 when jumping into above sub
4. the sub sets it to +1 = 0
5. and the error occurs in the Property:
Code:
Public Property SelectedIndex() As Int32
Get
Return Me.Pages.IndexOf(CType(Me.SelectedPage, WizardPage))
End Get
Set(ByVal Value As Int32)
If Value = -1 Then
Me.SelectedPage = Nothing
Else
Me.SelectedPage = DirectCast(Me.Pages(Value), WizardPage)
End If
End Set
End Property
on this line
Code:
Me.SelectedPage = DirectCast(Me.Pages(Value), WizardPage)
It seems the inital error is in the btnNext_Click-Sub, because there the SelectedIndex is set to a wrong value.