Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accesing advanced controls on child forms

Status
Not open for further replies.

Cborrow

Technical User
Joined
Jun 16, 2006
Messages
2
Location
US
Hi,
I have an MDI app and I am using the TextEditorControl from ICSharpCode. But it has some of the same functions as the TextBox, and RichTextBox like Undo, Redo, Cut, Copy, Paste, Etc. Well those are the kind of functions I can use when I try to do this for the Undo toolbar button or menu strip button

Code:
this.ActiveMdiChild.Controls["textEditorControl1"].Undo

That does not work because I guess that the Undo function is
not in the System.Windows.Forms functions and is a advanced function of the one of the TextBox, RichTextBox and TextEditorControl.

Now my question is how would I go about accessing those functions on the child window from the parent window?

Thanks, I hope I explained myself right
 
I think you'll get a compiler error for that line.

Try casting the Control object (from Controls["textEditorControl1"]) to a TextEditorControl object. Then call Undo().
Code:
TextEditorControl teCtrl = (TextEditorControl)this.ActiveMdiChild.Controls["textEditorControl1"];
teCtrl.Undo();
 
Thank you very much that worked perfectly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top