public void UpdateForm(FormBase targetForm, FormBase sourceForm) { foreach (PropertyInfo property in typeof(FormBase).GetProperties()) { foreach (Attribute attribute in property.GetCustomAttributes(true)) { if (attribute is FormBaseAttribute) { object sourceFormValue = property.GetValue(sourceForm); property.SetValue(targetForm, sourceFormValue); } } } targetForm.Refresh(); targetForm.Update(); }
public static void ShowForm(FormBase form, FormBase parent) { form.Show(); if (parent != null) parent.Close(); }