Alright, I have updated the WizardCtrl class. Instead of just a 'cancel' boolean, I decided to use custom Event Arguments that hold a "Cancel" property, and also a "CurrentPage" property that holds the current page.
This way, you can use the BeforeNextButton_Clicked event as such:
Assuming you have a TextBox1 on WizardPage3, whose text should be "Hello World". If it's text is not "Hello World" the Next button click should be canceled.vb.net Code:
Private Sub WizardCtrl1_BeforeNextButton_Clicked(ByVal sender As System.Object, ByRef e As WizardControlExample.BeforeNextButtonEventArgs) Handles WizardCtrl1.BeforeNextButton_Clicked 'Check current page If e.CurrentPage Is Me.WizardPage3 Then 'Validate info on current page If TextBox1.Text = "Hello World" Then e.Cancel = False Else e.Cancel = True End If End If End Sub
Since I am no longer running Vista, I am getting some problems with missing DLL files in my project on XP. I have never seen them before, but I'll look into them, I want this project to work on XP as well (obviously without Aero Glass).
This stops me from uploading the entire project however, so I have just attached the new 'WizardCtrl.vb' class. Replace the old 'WizardCtrl.vb' class with this new one. The only changes are the Before___ events.
In case you have already changed some of the WizardCtrl class and don't want to lose your work, you can open up my new WizardCtrl class and copy/paste the following sections into your custom WizardCtrl class:
- Under the 'Events' region: The 3 "Delegate" subs + the 3 Before___ events (lines 17 to 37).
- The btnNext_Click, btnPrev_Click and btnCancel_Click events are updated; view my changes and modify your own as needed (lines 303 to 336).
- The entire (new) 'Event Handlers' region containing three new classes (lines 597 to 641).
Hope you are satisfied with the changes!




Reply With Quote