Divelements Community
Customer discussion of all Divelements products

String to wizard page

Latest post 04-25-2006 15:46 by Ken A. 4 replies.
  • 04-23-2006 1:10

    • Ken A
    • Top 500 Contributor
    • Joined on 04-22-2006
    • Posts 6

    String to wizard page

    I'm saving the current page to a text file so the wizard can be closed then re-opened later.  How do I convert the page name string to a page?

    dim curPage as string = wizard1.selectedpage.tostring

    'later on

    wizard1.selectedpage = curPage 'Here is where I need to convert the string to a page.

    Thanks for any help.

  • 04-24-2006 22:55 In reply to

    Re: String to wizard page

    G'day Ken,

    The wizard page is of type:   Divelements.WizardFramework.WizardPageBase

    When storing the name of the page that your user is viewing, use the following to retrieve the proper page name:

    string PageName = this.wizard1.SelectedPage.Name;


    when you next load the wizard and you have it starting on the first page, then you can call a method like the following parsing the previous string:


            /// <summary>
            /// Set the Page to view
            /// </summary>
            /// <param name="PageName">The page name required</param>

            public void SetPage(string PageName)
            {
                bool PageFound = false;
                while (!PageFound)
                {
                    //Move to the next page
                    this.wizard1.GoNext();

                    if (wizard1.SelectedPage.Name == PageName)
                    {
                        //Jobs Done
                        PageFound = true;
                        break;
                    }
                }
            }





  • 04-25-2006 2:10 In reply to

    • Ken A
    • Top 500 Contributor
    • Joined on 04-22-2006
    • Posts 6

    Re: String to wizard page

    Hi Wilbur,

    Thank you for the response.  That works fine.  Thank you!!

    For future info, is there a way to convert a string to an object type; in this case a wizard page object?

  • 04-25-2006 9:13 In reply to

    Cool [H] Re: String to wizard page

    Howdy Ken,

    You can do whatever you want!! don't let anyone else tell you different...

    Just for reference though...

    Create Wizard Page to Object

    First Create the object class or structure like the following:

            private class MyWizardObject
            {
                private Divelements.WizardFramework.WizardPage _myPage;

                public Divelements.WizardFramework.WizardPage MyPage
                {
                    get { return _myPage; }
                    set { _myPage = value; }
                }
            }


    Next create the method for getting back the wizard page so you can store it..

            public Divelements.WizardFramework.WizardPage GetCurrentPage()
            {
                //Make sure you cast it here
                return (Divelements.WizardFramework.WizardPage)this.wizard1.SelectedPage;
            }

    Next make the overload of the previous method to set the page (the method I gave you in the other post for string)

            public void SetPage(Divelements.WizardFramework.WizardPage MyNewPage)
            {
                this.wizard1.SelectedPage = MyNewPage;
            }


    So now we are ready to rock and roll....

    Instantiate the object class and fill the value via property using our method above

            //Global Object
            private MyWizardObject NewWizardObject = null;

            /// <summary>
            /// Instantiate a MyWizardObject Object and fill it
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>

            private void button1_Click(object sender, EventArgs e)
            {           
                NewWizardObject = new MyWizardObject();
                NewWizardObject.MyPage = this.Wizard1.GetCurrentPage();
            }

    Job's done... To tell the wizard to go to our page object call our overloaded method..
            /// <summary>
            /// Call our wizard method to set the page with our stored object value
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>

            private void button2_Click(object sender, EventArgs e)
            {
                this.
    Wizard1.SetPage(NewWizardObject.MyPage);
            }


    Hope that helps...
  • 04-25-2006 15:46 In reply to

    • Ken A
    • Top 500 Contributor
    • Joined on 04-22-2006
    • Posts 6

    Re: String to wizard page

    Thanks again Wilbur, I'll study that.  You've been a big help.
Page 1 of 1 (5 items) | RSS
Copyright © 2008 Divelements Limited
Powered by Community Server (Commercial Edition), by Telligent Systems