access to active MDIChild
Hi everyone.
I have a problem.
I am trying to create a texteditor with multiple documents.
I have main form with buttons,etc.....
and when I press button i create MDIChild forms with RichTextBox.:
private void button_NEW_Click(object sender, System.EventArgs e)
{
clsDocumentForm doc = new clsDocumentForm();
doc.MdiParent = this;
}
But if I create more of them and I want to do something with RichTextBox in one which is currently active,I don't know how.
This code below throw error,that I can't convert Form to my clsDocumentForm.
private void TextEditor_MdiChildActivate(object sender, EventArgs e)
{
clsDocumentForm activeChild = this.ActiveMdiChild;
activeChild.RichTextBox1.Text = "something";
}
It is propably easy ,but I just don't know.
Thank you very much.