I get InvalidCastException.
It says "Unable to cast object of type 'HD.MainMenu' to type 'HD.NewBookEntry'" and points to this statment "mpg=(NewBookEntry)fm"
Plz help me to solve this.
My code is:

FormCollection fms=Application.OpenForms;
            foreach(Form fm in fms)

Form has a public Dispose() method. Why are you trying to cast between the two types? Assuming that both classes derive from Form, HD.MainMenu and HD.NewBookEntry are both ancestors of Form, and have common variables/methods from Form. However, they define their own variables/methods, therefore they lack a commonality between them.

I figured it out.

Form2 nbe = (Form2)Application.OpenForms["Form2"];