Yo!
I've created a class, clsWizardStep, to hold the data for the 'steps' for my 'application configuration wizard' and one of the properties of this class is simply to hold which Panel will be visible during the defined step.
The steps are stored in a List(Of clsWizardStep). When I try to set the panel visible, the change in boolean value for the property doesn't take effect.
So culling off any code I can't see being necessary, here's what I've got. Sorry to make this so long, at least I've remembered to include some code!
My class...
vb.net Code:
Public Class clsWizardStep Private _Title As String Private _Description As String Private _Panel As Panel Private _ButtonText_Prev As String Private _ButtonText_Next As String Public Property Title() As String Get Return _Title End Get Set(ByVal value As String) _Title = value End Set End Property Public Property Description() As String Get Return _Description End Get Set(ByVal value As String) _Description = value End Set End Property Public Property Panel() As Panel Get Return _Panel End Get Set(ByVal value As Panel) _Panel = value End Set End Property Public Property ButtonText_Prev() As String Get Return _ButtonText_Prev End Get Set(ByVal value As String) _ButtonText_Prev = value End Set End Property Public Property ButtonText_Next() As String Get Return _ButtonText_Next End Get Set(ByVal value As String) _ButtonText_Next = value End Set End Property End Class
Function to add an item to the list:
vb.net Code:
Public Sub WizardSteps_AddStep(ByVal lstList As List(Of clsWizardStep), ByVal strTitle As String, ByVal strDescription As String, ByVal pnlPanel As Panel, ByVal strButtonText_Prev As String, ByVal strButtonText_Next As String) Dim thisStep As New clsWizardStep thisStep.Title = strTitle thisStep.Description = strDescription thisStep.Panel = pnlPanel thisStep.ButtonText_Prev = strButtonText_Prev thisStep.ButtonText_Next = strButtonText_Next lstList.Add(thisStep) End Sub
And in this function, I try to change the Visible property of the panel:
vb.net Code:
Private Sub Wizard_Next() Handles btnNext.Click If intCurrentPosition < (lstWizardSteps.Count - 1) Then intCurrentPosition += 1 lblHeader.Text = lstWizardSteps(intCurrentPosition).Title lblStepDescription.Text = lstWizardSteps(intCurrentPosition).Description btnPrev.Text = lstWizardSteps(intCurrentPosition).ButtonText_Prev btnNext.Text = lstWizardSteps(intCurrentPosition).ButtonText_Next Dim thisPanel As Panel thisPanel = lstWizardSteps(intCurrentPosition).Panel thisPanel.Visible = True Debug.WriteLine(thisPanel.Visible) Else 'Perform a Save? MessageBox.Show("This is where you save your settings...") Me.Close() End If End Sub
The list works fine, the items are created. The properties for the class are set. The panels exist.
I've tried a few different methods for setting the property, none have worked.
I.e.
vb.net Code:
Dim thisPanel As Panel thisPanel = DirectCast(lstWizardSteps(intCurrentPosition).Panel, Panel) thisPanel.Visible = True 'or Dim thisPanel As New Panel thisPanel = lstWizardSteps(intCurrentPosition).Panel thisPanel.Visible = True 'or lstWizardSteps(intCurrentPosition).Panel.Visible = True
Since then, I have tried setting Modifiers properties of the panels to "Public" and that also didn't make any difference. I also tried adding a Sub to the class to change the property but assuming I did that correctly, it also didn't work. Arrgghh!
Clearly I'm missing something here, tried for an hour to nut this out to no avail. Any help peoples? Hope so!
Thanks!
Scott


Reply With Quote