I need some help on passing a value from one class to the main window. The Main Window is up and running in the background, so a new instance is not needed (I don't think). The Main Window is a tab control using DevExpress. One the tab, I have a button. When the button is pressed, it opens a new window. I type text into the new window, check the spelling, and press the Return Data button. When I press the Return Data button, I want the text in the Rich Text Editor to pass to the Main Window in a textbox.
Here's the code I have now, but for some reason I keep getting that annoying error "object not set to an instance of an object". Can you help?
public MainWindow Main = null;
private void ReturnData_Click(object sender, RoutedEventArgs e)
{
var val = RichEditControl1.Text;
Main.TbNoteText.Text = val;
Close();
}