[2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support! - Page 2-VBForums
Page 2 of 2 FirstFirst 12
Results 41 to 64 of 64

Thread: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support!

  1. #41
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,827

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Nick,

    When playing around with your control, I'm not able to see a change when the visible property of a page is set to False.

    Whether I set it in the designer or during run time, it doesn't reflect when changing pages.

    Do you know why this might be?

    Thanks
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  2. #42

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Hm, why are you setting the visible property to false?

    I think I'm using the visible property to hide/show the pages when appropriate (alongside bringing them to the front). So it is going to be changed all the time by the container control, when you change the selected page.

  3. #43
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,827

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    I have 4 CheckBoxes that allows the user to select which pages they need to use. If, for instance, they only need to work with the content that is on page 2, I need to be able to not show pages 1, 3, and 4.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  4. #44

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    That's not usually how a wizard works, but ok

    Hm. I'm not too sure how to approach this. You can handle the button events (I think there's NextButtonClicked, etc), which should have a Cancel property in the event arguments (e). Well, I showed someone how to add that property once, I'm not really sure if I've added it to the actual project yet.
    Anyway, that would allow you to cancel navigation when you don't want it.

  5. #45
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,827

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Thanks for the info, Nick.

    I'll play around with it to see what I can figure out.

    Quote Originally Posted by NickThissen
    That's not usually how a wizard works, but ok
    Yeah... I guess not. I need the functionality of a wizard, with this specific option. And since this part of the GUI is integral to the main functionality of the app, I can't move forward until I get this figured out.

    Thanks again
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  6. #46
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,827

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Nick,

    When trying to import your control into a new project, instead of testing out the project example, I'm not able to fully import the ThreeDLine.vb file.

    When importing WizardCtrl.vb and WizardPage.vb, it imports the appropriate designer and resx files. When importing the ThreeDLine.vb file, it doesn't import the 3DLine.Designer.vb and 3DLine.resx files. I can import them separately, but they aren't tied to the 3DLine.vb file.

    Do you know why this might be? Could it be something with what VS you developed it in? I think you must have used VS 2005 to develop it since it has me upgrade the files prior to opening the project.
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  7. #47

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Hm, perhaps it has to do with the name... Try renaming all files to the same name (ThreeDLine instead of 3DLine, I don't know if you can use numbers) before adding the file.
    Not sure why I didn't get that. I can't remember if I made this in VS2005 but I used it in VS2008 as well, pretty sure about that.

  8. #48
    Wait... what? weirddemon's Avatar
    Join Date
    Jan 2009
    Location
    USA
    Posts
    3,827

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    It seems the naming was the issue.

    Thanks
    CodeBank contributions: Process Manager, Temp File Cleaner

    Quote Originally Posted by SJWhiteley
    "game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....

  9. #49
    Frenzied Member Pc_Not_Mac's Avatar
    Join Date
    Oct 2009
    Location
    localhost
    Posts
    1,206

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Great project i just have a question how can you add these two navigation buttons?
    Attached Images Attached Images  
    My Codebank:
    Windows Vista & 7 Glass Effect & Limit the amount of times your application could be opened.
    Pause Your Code & Check the OS name

    The question of whether computers can think is like the question of whether submarines can swim.

    Currently learning: Java

    Coding can be a learning experience or

  10. #50

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    I'm sure you can just place two images there with some mouse hover and click events. Although the background between the images is probably a little more difficult.

  11. #51
    Frenzied Member Pc_Not_Mac's Avatar
    Join Date
    Oct 2009
    Location
    localhost
    Posts
    1,206

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    I see thanks for the reply.
    My Codebank:
    Windows Vista & 7 Glass Effect & Limit the amount of times your application could be opened.
    Pause Your Code & Check the OS name

    The question of whether computers can think is like the question of whether submarines can swim.

    Currently learning: Java

    Coding can be a learning experience or

  12. #52
    Member
    Join Date
    Sep 2010
    Location
    Huntsville, AL
    Posts
    62

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    I hate to bump an old thread, but I'm having a redraw/cleanup issue with the wizard control. I've done the following:

    1. Downloaded latest non-Aero version
    2. Rename appropriate ThreeDLine files
    3. Create new project in VS 2008
    4. Add existing items...selected source files
    5. Build project
    6. Add wizard control to userform
    7. set wizard control DockStyle to Fill
    8. Debug/Run project
    9. Stop debugging


    After this, the design-time view of my userform no longer shows the wizard control. Closing the userform's designer and reopening it fixes the problem. Is this some sort of dispose/finalize bug? I don't know enough about .Net and/or user controls to really track what is happening.

    The two images display what I'm trying to write. The first is a view of my project before I debug/run. The second is after I stop debugging. When I close and reopen formMain.vb, everything looks like the first image again.

    Thanks.
    Attached Images Attached Images   

  13. #53

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    I'm not sure what is causing the problem, but I do have a workaround (that's actually better practice then what you are doing). Instead of dumping all the files in your Windows Forms Application project, add a new Windows Forms Control Library project to your solution (I am assuming you're using Visual Studio and not one of the Express versions). Then add the files to that control library project (be sure to reference System.Design) and reference the control library project from your main project. When doing this, the control no longer disappears from my form. Again, I have no idea why, but it works for me.

    If you do have the Express versions, you can always create a new Class Library project (I don't think Control Library is available in Express?), add the required references (System.Windows.Forms probably and maybe some others), and build it. Then you get a DLL file that you can reference from your main project, and it should work the same.

  14. #54
    Member
    Join Date
    Sep 2010
    Location
    Huntsville, AL
    Posts
    62

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Okay thanks. I'll have to try the Express version of your work-around.

  15. #55
    Member
    Join Date
    Sep 2010
    Location
    Huntsville, AL
    Posts
    62

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Work-around is great! Also, before I tried your work-around, I discovered that if I added a second wizard page to the control (during design-time), the disappearing control problem went away.

    Also, the updated wizard control that includes the cancel button_press events, removed the code that toggles the visibility of the header panel based on the value of a wizard page's IsWelcomePage property. The code for the cancel event wizard control:
    Code:
        Public Overridable Sub OnSelectedPageChanged(ByVal e As EventArgs)
            Static oldSelection As WizardPage = Nothing
            If Not (oldSelection Is Nothing) Then
                oldSelection.Visible = False
            End If
            If Not (m_SelectedPage Is Nothing) Then
                CType(m_SelectedPage, WizardPage).Visible = True
            End If
            Dim tabChanged As Boolean
            If m_SelectedPage Is Nothing Then
                tabChanged = Not (oldSelection Is Nothing)
            Else
                tabChanged = Not (m_SelectedPage.Equals(oldSelection))
            End If
            If tabChanged And Me.Created Then
                RaiseEvent SelectedIndexChanged(Me, EventArgs.Empty)
            End If
            oldSelection = CType(m_SelectedPage, WizardPage)
    
            ' Update title/description/icon
            Dim page As WizardPage = Me.SelectedPage
            If page IsNot Nothing Then
    
                Me.Invalidate()
    
                If page.Icon IsNot Nothing Then
                    Me.picIcon.Image = page.Icon
                    Me.picIcon.Visible = True
                Else
                    Me.picIcon.Visible = False
                End If
    
                btnPrev.Enabled = (Me.SelectedIndex > 0)
    
                If page.IsLastPage Then
                    btnNext.Text = FinishButtonText
                ElseIf page.IsWelcomePage Then
                    btnNext.Text = StartButtonText
                Else
                    btnNext.Text = NextButtonText
                End If
    
            End If
        End Sub
    The code how I modified it:
    Code:
        Public Overridable Sub OnSelectedPageChanged(ByVal e As EventArgs)
            Static oldSelection As WizardPage = Nothing
            If Not (oldSelection Is Nothing) Then
                oldSelection.Visible = False
            End If
            If Not (m_SelectedPage Is Nothing) Then
                CType(m_SelectedPage, WizardPage).Visible = True
            End If
            Dim tabChanged As Boolean
            If m_SelectedPage Is Nothing Then
                tabChanged = Not (oldSelection Is Nothing)
            Else
                tabChanged = Not (m_SelectedPage.Equals(oldSelection))
            End If
            If tabChanged And Me.Created Then
                RaiseEvent SelectedIndexChanged(Me, EventArgs.Empty)
            End If
            oldSelection = CType(m_SelectedPage, WizardPage)
    
            ' Update title/description/icon
            Dim page As WizardPage = Me.SelectedPage
            If page IsNot Nothing Then
                Me.lblPageTitle.Text = page.Title
                Me.lblDescription.Text = page.Description
                If page.Icon IsNot Nothing Then
                    Me.picIcon.Image = page.Icon
                    Me.picIcon.Visible = True
                Else
                    Me.picIcon.Visible = False
                End If
    
                btnPrev.Enabled = (Me.SelectedIndex > 0)
    
                If page.IsLastPage Then
                    btnNext.Text = FinishButtonText
                Else
                    btnNext.Text = NextButtonText
                End If
    
                If page.IsWelcomePage Then
                    btnNext.Text = StartButtonText
                    Me.Top3DLine.Visible = False
                    Me.pnlHeader.Visible = False
                Else
                    Me.Top3DLine.Visible = True
                    Me.pnlHeader.Visible = True
                End If
    
                Me.Invalidate()
            End If
        End Sub
    Hopefully that made sense. The changes come after the comment "Update title/description/icon".

  16. #56
    Hyperactive Member
    Join Date
    Jun 2009
    Posts
    257

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Sorry to bump...

    Nick, how would I have the form close after the finish button has been clicked?

    Currently... This code:

    Code:
        Private Sub wizard_AddSupplier_NextButton_Clicked(ByVal WasLastPage As Boolean) Handles wizard_AddSupplier.NextButton_Clicked
            If (WasLastPage) Then
                If (Supplier.saveSupplier()) Then
                    MsgBox("The Supplier with Reference: " + Supplier.Reference().ToString() + ", has been added to the System", MsgBoxStyle.Information, "Supplier Added")
                    Me.Close()
                Else
                    MsgBox("An error occured when trying to Add the Supplier", MsgBoxStyle.Exclamation, "Unable to Add Supplier")
                End If
            End If
        End Sub
    Produces, this error:

    Index 0 is out of range.
    Parameter name: index
    Thanks.

  17. #57

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Where does that error occur? If you're using the source code you should be able to tell my exactly where it goes wrong. If you are using a compiled version, does it error before it even raises the NextButton_Clicked event or somewhere in your own code?

  18. #58
    Hyperactive Member
    Join Date
    Jun 2009
    Posts
    257

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Quote Originally Posted by NickThissen View Post
    Where does that error occur? If you're using the source code you should be able to tell my exactly where it goes wrong. If you are using a compiled version, does it error before it even raises the NextButton_Clicked event or somewhere in your own code?
    It happens on the 'Set' of the SelectedIndex() Property in WizardCtrl.vb on the line:

    Code:
    Me.SelectedPage = DirectCast(Me.Pages(Value), WizardPage)

  19. #59
    New Member
    Join Date
    Oct 2010
    Posts
    8

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Hey Nick,

    first i want to thank you for this easy to use control

    and second: did you find a solution for r000t's error? i've got the same, when i try to clode the wizard after clicking the finish-button.

  20. #60

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Quote Originally Posted by NoobOne View Post
    Hey Nick,

    first i want to thank you for this easy to use control

    and second: did you find a solution for r000t's error? i've got the same, when i try to clode the wizard after clicking the finish-button.
    Hmm, it seems like it is trying to set the SelectedIndex property to 0, but I don't know why, I'll have to look in the source code, and I won't have time for that soon.

    Perhaps one of you can take a look where this happens? Does it happen after the Me.Close call is made, or even before that? If it happens before that line (you can check by putting a breakpoint on the Me.Close call) then it must be somewhere in the Next button clicking event (in the control source). If not, it must be something related to the control being disposed, in which case it might also be an error in the design-time code...

  21. #61
    New Member
    Join Date
    Oct 2010
    Posts
    8

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    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.

  22. #62

    Thread Starter
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    Ok, thanks. It seems the pages are being disposed from the form once you run the Close call. This happens in the RaiseEvent call from your first code snippet. After that, it sets the SelectedIndex to the next page, but only if there is a next page.

    The error is that this "is there a next page?" check is done before the RaiseEvent and thus before all pages are removed. Before the RaiseEvent, i = the number of pages - 1. If nothing happens with the page count in the NextButton_Click event, i doesn't change. But in this case, the page count changes and i is outdated. I think simply moving the assignment of i to behind the RaiseEvent call would fix it:
    Code:
    Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
            RaiseEvent NextButton_Clicked(CType(Me.Pages(Me.SelectedIndex), WizardPage).IsLastPage)
    
            Dim i As Integer = Me.Pages.Count - 1
            If Me.SelectedIndex < i Then
                Me.SelectedIndex += 1
            End If
    End Sub

  23. #63
    New Member
    Join Date
    Oct 2010
    Posts
    8

    Re: [2008][UPDATE, Aero Glass] Wizard Template UserControl - Full Design-time support

    That's it.

    Now it closes without any errors.

    Btw. how you want to be mentioned in a released program? a line in the About-Dialog?

  24. #64

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.