无法为属性赋值 - 它是只读的

weixin_43936063 2023-07-19 20:05:28

namespace 单例
{    
    public partial class ZhuForm : Form
    {       
        public ZhuForm()
        {            InitializeComponent();             }     

        public static ZhuForm tank0
            {     

                   get            {         if (tank0 == null)     tank0 = new ZhuForm();                }
                   return tank0 ;
            }     

        public void LoadChildPage(Form form)      // 每次加载子窗口的时候关闭其他窗口

         {   
               foreach (var item in tank.MdiChildren)        item.Close();                                        
                form.Show();                                            

         }


        static ZhuForm tank;

    }

...全文
277 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
足球中国 2023-07-27
  • 打赏
  • 举报
回复

tank0 = new ZhuForm(); 改为 tank= new ZhuForm();

weixin_43936063 2023-07-19
  • 打赏
  • 举报
回复

img

33

社区成员

发帖
与我相关
我的任务
社区描述
让技术改变世界,让爱好进行到底。
c#后端.net 技术论坛(原bbs) 江苏省·南京市
社区管理员
  • 数智前沿
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧