Call function in different child forms from MDI form with C#
Posted on 2008-10-16
Hi expert !
Im new in C# and need help. With NET Framework 2.0 and C# 2008 i need to make MDIform and many child forms with different textboxes and buttons and so on. I need to make buttons in MDI form and when click on this buttons to call function in child forms. If child form have not this function in it will not do nothing.
but when compile have error which tell that function aaaa() doesnt exsist. How to avoid this befaour? May be with Reflection ?
Note: till now I reach to follow code which work
foreach (Form frm in this.MdiChildren)
if (frm is frmRequestAd)
frmRequestAd f = frm as frmRequestAd; f.aaaa(); break;
, but I will have many chid form and many buttons and when add new child form I will need on EVERY button to add such text &