本文介绍了从孩子更改MDI父母的财产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有以下三种形式:
frmMainfrmLoginfrmPanel.


当我运行程序时,它显示frmMain这是一个MDI容器,并在加载时以子级形式打开登录"表单.

现在,当我登录并且信息正确时,我需要启用toolstrip1上的按钮,这些按钮在加载时被禁用.

我尝试过的是在frmMain
中创建一个函数

Hello there,

I have three forms:
frmMain, frmLogin and frmPanel.


When I run my program it shows frmMain which is an MDI container, and on load I open Login form as child.

Now when I login and information is correct I need to enable buttons on my toolstrip1 which are disabled on load.

What I''ve tried is to make a function inside frmMain

void functionOnForm1()
{
    this.toolStripButton7.Enabled = true;
}


然后在密码确定后在登录表单上调用此函数:


then on login form after password is OK I call this function:

((frmMain)this.MdiParent).functionOnForm1();


但出现以下错误:
由于其保护级别(CS0122),无法访问"Project1.frmMain.functionOnForm1()".

这是frmMain:


but I get the following error:
''Project1.frmMain.functionOnForm1()'' is inaccessible due to its protection level (CS0122).

This is frmMain:

public partial class frmMain  : Form
{
    public frmMain()
    {
        InitializeComponent();
    }

    void functionOnForm1()
    {
        MessageBox.Show("ddd");
    }
}


推荐答案



这篇关于从孩子更改MDI父母的财产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 00:12