I need help transferring text from one textbox in one page to another textbox in another page since I'm new to WPF. I was able to change pages, but I can't get the textbox from the first page into the textbox in the second page. It just changes pages but doesn't add in the value from the 1st textbox. I've been looking for help for hours but can't make it work out.
Page1.xaml:
<TextBox x:Name = "ATextBox" KeyDown="AppealNumberTextBoxEnter"/>
Page1.cs:
private void AppealNumberTextBoxEnter(object sender, KeyEventArgs e)
{
//When Enter Key is pushed in textbox
if (e.Key == Key.Return)
{NavigationService ns = NavigationService.GetNavigationService(this);
ns.Navigate(new Uri("Page2.xaml", UriKind.Relative));}
Page2 p2 = new Page2();
p2.BTextBox.Text = ATextBox.Text;
Page2.xmal:
<TextBox x:Name = "BTextBox" KeyDown="BillingDateTextBoxEnter"/>
Page2.cs:
private void BillingDateTextBoxEnter(object sender, KeyEventArgs e)
{
//When Enter Key is pushed in textbox
if (e.Key == Key.Return)
{
MessageBox.Show("Find Billing date for: " + BTextBox.Text);
}
}