I'm having trouble getting text from a textbox in c#/xaml. I am running 2 methods - the first which creates a stackpanel and adds 2 textboxes to it and the second is intended to just take the text from the 2 textboxes and assign it to a class object I have defined elsewhere. However - when I try to get the textbox.text, it says it doesn't recognise the variable name I have used for the textbox object. Can anyone offer any clue as to what I'm doing wrong? Here's my code.I'm having trouble getting text from a textbox