开发者

call form from project added as refrence to other one

开发者 https://www.devze.com 2023-01-23 16:21 出处:网络
i have 2 projects when t开发者_运维技巧he user Click on a button in the first project he suppose to see the form which in the Second Project ??

i have 2 projects when t开发者_运维技巧he user Click on a button in the first project he suppose to see the form which in the Second Project ?? i am using C#


A form is just a class like any other

Library.FormClass F = new Library.FormClass()
F.Show();


Your Second Project must be compiled with the output type of Class Library. Then get a reference of the dll of your second project to your first project.

You can access a form (or controls, etc..) from your second project by creating a new object of that form.

private void button1_Click(object sender, EventArgs e)
{ 
    SecondProject.Form1 f1 = new SecondProject.Form1()
    f1.Show();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号