c# - Transferring data from one page to another windows 8 phone app -


I am trying to transfer data from one page to another, in which I am making. I'm getting the error Error 1 Name 'EnterName Box' is not present in the current context Can someone tell me what I did wrong? The first page (getStartedButton takes you to another page) [code]

  using the system; Using System.Collections.Generic; Using System.Linq; Using System.Net; Using System.Windows; Using System.Windows.Controls; Using System.Windows.Navigation; Using Microsoft.Phone.Controls; Use of Microsoft phone. Shell; Using FinalProjectPhoneVersion.Resources; Namespace Ultimate ProjectPhone Warson {Public Partial Class Home Page: Phone Apps Page {Stable Int Strike; Stable int counter; Stable random random = new random (); Static ER random number 1; Static and random number 2; // Constructor Public Manpage () {Initialization (); // ApplicationBar // BuildLocalizedApplicationBar () sample code for localization; } // Set local code for BuildLocalizedApplicationBar () // // // on a localized ApplicationBar // Private Zero // Set a new instance of ApplicationBar on the ApplicationBar page. // ApplicationBar = New ApplicationBar (); // // Create a new button and set the text value in the localized string from AppResources. // ApplicationBarIconButton appBarButton = New ApplicationBarIconButton (New Uri ("/ Assets / AppBar / appbar.add.rest.png", UriKind.Relative)); // appBarButton.Text = AppResources.AppBarButtonText; // ApplicationBar.Buttons.Add (AppBarbuttons); // // Create a new menu item with local string from AppResources. // ApplicationBermain menu item item menu item = new application word menu item (apesources.appbar menu item text); // ApplicationBar.MenuItems.Add (appBarMenuItem); //} public math page () {initial group (); String welcomeStreasting = (string) PhoneApplication service. Present. Location ["Enter name"]; Radio button easy mode = (radio button) Phone application service. Present. Location ["Easy Mode"]; Radiobutton Hardmode = (Radiobutton) Phone Results Service Present. Location ["hardmoda"]; WelcomeLabel.Text = "Welcome" + WelcomeString; If (easyMode.Checked = true) {}} Private Zero getStartedButton_Click (Object Sender, RoutedEventArgs e) {MathTime (); Navigation service Navigate (new URI ("/ Page1.xaml? EnterNameBox = test", Urekhind.relative)); }}}  

[/ code]

second page [code]

  using the system; Using System.Collections.Generic; Using System.Linq; Using System.Net; Using System.Windows; Using System.Windows.Controls; Using System.Windows.Navigation; Using Microsoft.Phone.Controls; Use of Microsoft phone. Shell; Namespace Ultimate ProjectPhone Warsen {Public Partial Class Math Pages: Phone Applications Page {Public Mathematical Page} {Initial Group (); WelcomeLabel.Text = "Welcome" + Enter the name box; Text; } Private Zero TextBox_TextChanged (Object Sender, TextChangedEventArgs E) {} Protected Override Zero OnNavigatedTo (System.Windows.Navigation.NavigationEventArgs e) {base.OnNavigatedTo (e); String parameter value = Navigation contact .QueryString ["enterNamebox"]; }}}}  

[/ code]

I recommend Instead of saving the values ​​between pages, use the Phone Apps service.

  PhoneApplicationService.Current.State ["id_of_value"] = Value;  

First page

  PhoneApplicationService.Current.State ["enterNameBox"] = "test"  

second page

  string my_string = (string) PhoneApplicationService.Current.State ["enterNameBox"]; More info can be found here  

EDIT: Your radio button was in the middle of answering the comment, but it seems that you removed it. This should work for most types

First page

  PhoneApplicationService.Current.State ["radio_button1"] = this.your_radio_button.  

second page

  RadioButton rb = (RadioButton) PhoneApplicationService.Current.State ["radio_button1"]; Rb.Ischecked = True; // or false  

When you press the back button, your radio button will also update as its own.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -