locked
Passing Multiple strings between pages

    Question

  • Guys

    Im trying to pass multiple strings to a 2nd page but have got stuck

    On Page one I navigate to Page 2 by using the following

                this.Frame.Navigate(typeof(ReportFault), string1.Text);

    On Page 2 I get the string that has been passed from page 1 and put it into a textbox using the following

                string name = e.NavigationParameter as string;
                pageTitle.Text = name;

    This all works fine but only passed 1 string to the next page

    I have 4 strings on page 1

    string1.text

    string2.text

    string3.text

    string4.text

    how do I pass all 4 strings from page 1 to page 2

    Any help apprciated

    Mark

    Tuesday, February 25, 2014 1:24 PM

Answers

  • You can Join your Four string into one string with and add "|" between them as a seperator, then pass the new string using the navigate method, in your second page use the split method (Regex.Split) to split the one string into your four strings.

    Tariq

    • Marked as answer by wambaugh1 Tuesday, February 25, 2014 4:49 PM
    Tuesday, February 25, 2014 3:55 PM

All replies

  • You can Join your Four string into one string with and add "|" between them as a seperator, then pass the new string using the navigate method, in your second page use the split method (Regex.Split) to split the one string into your four strings.

    Tariq

    • Marked as answer by wambaugh1 Tuesday, February 25, 2014 4:49 PM
    Tuesday, February 25, 2014 3:55 PM
  • What Jordan writes is a solution, but personally i think that little hacky. The data isnt saved somewhere else before?on tip: dont create a custom class and send that as parameter, the suspensionmanager is going to crash if you do


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, February 25, 2014 4:34 PM
  • Thanks tariq

    Did what you said and it works

    Mark

    Tuesday, February 25, 2014 4:50 PM