利用反射打开新窗口


using System.Reflection;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        int Value
        {
            get;
            set;
        }
        public Form1()
        {
            InitializeComponent();
        }

        private void button_Click(object sender, EventArgs e)
        {
            label1.Text = "";
            Assembly assembly = Assembly.GetExecutingAssembly();
            try
            {
                Form f = assembly.CreateInstance("WindowsFormsApp1." + "Form" + textBox1.Text) as Form;
                f.ShowDialog();
            }
            catch(System.NullReferenceException)
            {
                label1.Text = textBox1.Text + " not exist";
            }
        }
    }
}

优质内容筛选与推荐>>
1、P2587 [ZJOI2008]泡泡堂 神仙贪心
2、BZOJ2406矩阵——有上下界的可行流+二分答案
3、spring boot——关于一个Mysql主键的问题
4、如何保证消息的顺序性
5、web综合案例04


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号