Well, num3 can't be null because it's a value type, that means that txt3 is null. txt3 is null because the TextChanged event is raised when txt2's Text property is set in XAML which likely happens before the txt3 TextBox is created.
One simple solution is to remove the TextChanged event from XAML and put it in the constructor, after InitializeComponent:
public MainWindow() {
InitializeComponent();
txt2.TextChanged += txt2_TextChanged;
}