0

I am creating a windows phone 8.1 app that has 2 forms: the mainPage and the secondePage.

The mainPage is the page that loads first, and I have a button to go to secondePage, then I must pass some data from secondePage to mainPage and that's when I got a NullReferenceException because the data I "passed" didn't actually pass.

I tried some code I found here on stackoverflow and in some tutorials but it didn't work because they use an expression in the OnNavigatedTo function and I'm passing data from second to mainPage. Can you help me find a way to get this data passed?

ErikE
  • 48,881
  • 23
  • 151
  • 196
TeachMePls
  • 197
  • 1
  • 2
  • 11

2 Answers2

0

You could possibly try using Isolated Storage? for example you could save the data eg - text from a textbox and have at load up when you open the second page? just some food for thought

Merve
  • 23
  • 7
  • Isolated Storage is better suited for the app to 'remember' variables like user settings when the app is restarted. For this user's problem I think it would be better to have a static, public, utility class where information can be read/written across different pages. – kernanb Aug 15 '15 at 07:07
  • this is true, however he could still use isolated storage and have it reset each time he opens the app. – Merve Aug 15 '15 at 08:08
0

Need to see your code, but to save you time, view this link:

You may find the answer at that link as it answers these questions:

  1. When navigating between pages in an XAML application how do you pass parameters?
  2. What is the difference between using the Uri navigation and manual navigation?
  3. How can objects (not just strings) be passed when using Uri navigation?

If this answered your question, please mark this as answered.

Community
  • 1
  • 1