I have this working code:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
string name = tbxName.Text;
string age = tbxAge.Text;
string dinner = tbxDinner.Text;
}
private void OutputNewValues()
{
string answer = "Hello, " + tbxName.Text + " you are " + tbxAge.Text + " years old. " + tbxDinner.Text + " sounds yummy for dinner!";
finalOutput.Text = answer;
}
}
Now, in this part:
private void OutputNewValues()
{
string answer = "Hello, " + tbxName.Text + " you are " + tbxAge.Text + " years old. " + tbxDinner.Text + " sounds yummy for dinner!";
finalOutput.Text = answer;
}
I want to use the strings I declared earlier (name, age, dinner) instead of doing "tbxName.Text". But it will give me an error, because it doesn't exist in the current context.
What do I do/where do I put the string part to in order to use it anywhere?