I'm building a Notepad. I have a Find and Replace form. When I click a button that form opens, user gives two input in two textboxes and press a button. Then the RichTextBoxes from the main form is supposed to get modified.
Here's the form of the FindAndReplace
form :
private void btnReplaceAll_Click(object sender, EventArgs e)
{
string findMe = txtFind.Text;
string replaceMe = txtReplace.Text;
Form1 f1 = new Form1();
f1.MainText.Replace(findMe, replaceMe);
//this.Hide();
}
The problem is its not working.. I'm getting a NullReferenceException in the line f1.MainText.Replace(findMe, replaceMe);
Any idea?