Assembly.LoadFrom() : DLL 활용하여, Form을 띄우기
/*----------------------------------------------------------------------
Description : 클래스라이브러리로 생성되어진 폼을 띄울때에 사용되어진다.(폼형태만 가지고 인는것을 폼처럼 만들어서 띄울수있다.)
ex) 
1. frm's name : UAPDBMQ0010
2. dll's name : DBM.DLL
----------------------------------------------------------------------*/

sample code>>

string formName = "UAPDBMQ0010";
string dllName = formName.Substring(3,3); //DBM.DLL
string assembly = dllName + ".DLL";
string classname = dllName + "." + formName;

Assembly asm = Assembly.LoadFrom(assembly);
object o = asm.CreateInstance(classname);
var doc = (Form)o;

Form frm = doc;
frm.Tag = assembly;
if(frm == null) return null;

frm.MdiParent = this; //MDI CASE
frm.FormBorderStyle = FormBorderStyle.None; //NEW FORM
frm.Dock = DockStyle.Fill //POPUP, WHEN DELETE

frm.Text="";
frm.TopLevel=false;
frm.Parent=this;
frm.Show();

+ Recent posts