Form elements disappear

Wizard for Windows Forms Forum

Posted 19 years ago by S. Kollerie
Avatar
I build my wizard with

Inherits System.Windows.Forms.Form

A few things didn't work like wizard_SelectionChanged, so i changed it to Inherits ActiproSoftware.Wizard.WizardDialogForm

Now all my elements are gone and i get a new empty wizard so it seems.

What can i do? All i want to do is to get the wizard_SelectionChanged to work.

I'm using vb so please provide me with example code in vb (The manual has C#)

Thanks!

Comments (8)

Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi there... WizardDialogForm has it's own Wizard built in (via the WizardDialogForm property). So since you did this after you created your original form, you'll have to change the code in InitializeComponent so that your pages are added to the Form's Wizard property instead of the Wizard control instead that you originally created.

Make sure you back up your code before doing this. But give that a shot and let me know if you have any problems.

You can look at the VB test application code to see how to handle Wizard events when using WizardDialogForm since that's what the sample shows.


Actipro Software Support

Posted 19 years ago by S. Kollerie
Avatar
Hi!

I don't really see what you mean. I opened a new form added the component and start filling it with pages etc. Can you give me an (code) example of what you mean?

Thanks!
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
It would be easier if you just email us the code for your form and we look at it to make sure we're on the same page.


Actipro Software Support

Posted 19 years ago by S. Kollerie
Avatar
Public Class MainWizard
Inherits System.Windows.Forms.Form

Protected Overridable Sub OnSelectionChanged(ByVal e As EventArgs)

'When the processing page is being selected it is set up in the designer to disable all
'wizard buttons while processing is occurring...
'Do some processing here and then re-enable the appropriate buttons using code
If Me.Wizard1.SelectedPage Is PowerSupplyConfig Then
Me.Wizard1.BackButtonEnabled = False
Me.Wizard1.NextButtonEnabled = False

'Clear the processing amount
pgbCalcResults.Value = 0
ProcessingLabel.Text = "Ready to start..."

'Make the thread sleep for a second to simulate some simple processing
Dim i As Long
For i = 0 To 9
'Thread.Sleep(100)
pgbCalcResults.Value = pgbCalcResults.Value + 10
ProcessingLabel.Text = "Processing amount: " & CStr(i * 10) & "%"
Application.DoEvents()
Next i

'Re-enable the buttons now that the processing is complete
ProcessingLabel.Text = "Processing complete!"
Me.Wizard1.BackButtonEnabled = True
Me.Wizard1.NextButtonEnabled = True
End If
End Sub

Protected Overridable Sub OnCancelButtonClick(ByVal sender As Object, ByVal e As ActiproSoftware.Wizard.WizardCancelButtonDefault)
Me.Close()
End Sub
End Class


If i change Overridable in Overrides i get an error
Posted 19 years ago by S. Kollerie
Avatar
In other words:

The manual has two options for creating a wizard:

Option 1 - Creating a Form and Adding a Wizard

The first step in making a wizard is to create a Form for the wizard. Set the appropriate properties of the Form, such as FormBorderStyle and Text.

Place a Wizard control on the Form. Set its Dock property to Fill.


Option 2 - Creating a Form that Inherits WizardDialogForm

Alternatively, create a form that inherits the WizardDialogForm class. The WizardDialogForm already has a Wizard control built into it and exposes it as a property. It also takes all of the important Wizard events and provides methods that you can override to handle the events.

See the Wizard Dialog Form topic for more information on using a WizardDialogForm.


I used the first option and now i have the problem that i can''t use the cancelbutton and the OnSelectionChanging functions.
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I thought you said you started with option 1 but then converted to option 2. But now you are back on option 1? Sorry, I'm confused...

Anyhow if you are doing option 1 (regular Form with Wizard control added), then in your Form code, attach to the Wizard.CancelButtonClick event and make an event handler. Put your code there.

If you are doing option 2 (WizardDialogForm), override the OnCancelButtonClick method and put your code there.

Same concept applies for the other events as well.


Actipro Software Support

Posted 18 years ago by S. Kollerie
Avatar
Can you give me the example code in VB. I tried almost everything, but it doesn't work.

Thank's
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
We include a fully functional VB.NET sample project with the Wizard control that shows how everything works.


Actipro Software Support

The latest build of this product (v24.1.0) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.