如何通过单击第二个表单上的“保存”来禁用第一个表单上的组合框

发布于 2024-10-01 20:44:01 字数 568 浏览 0 评论 0原文

我想在单击第二个表单上的“保存”时禁用第一个表单中的组合框。

我有 2 个表单,我的要求是将 2 个表单数据附加在一起,这已完成

对于我的要求,我编写了一个小代码,但它对我不起作用

我的代码如下

编写代码如下

   public void loadingDatafrom(bool str)
    {
        if (true)
        {
            cmbServiceClassCode.Enabled = false;
        }
        else
        {
            cmbServiceClassCode.Enabled = true;
        }
    }

Form1 我在保存后 Form2并隐藏 form2 我调用上述方法

      frmBatch frmbatch = new frmBatch(frmmain);
    frmbatch.loadingDatafrom(true);

但这不起作用,请提供任何帮助。

I would like to disable the combo box which was in the first Form on clicking save on the second Form.

I am having 2 forms and my requirement is to append the 2 forms data together this was done

For my requirement i write a small code but it doesn't work for me

My code is as follows

Form1 i write my code as follows

   public void loadingDatafrom(bool str)
    {
        if (true)
        {
            cmbServiceClassCode.Enabled = false;
        }
        else
        {
            cmbServiceClassCode.Enabled = true;
        }
    }

Form2 after save and hiding the form2 i call the above method

      frmBatch frmbatch = new frmBatch(frmmain);
    frmbatch.loadingDatafrom(true);

But this is not working any help please.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

音盲 2024-10-08 20:44:01

我不确定是否理解你的问题。从主窗体 FrmBatch 中,以模态模式调用第二个窗体 FrmEntry。保存并关闭 FrmEntry 表单后,您必须禁用组合框。在 FrmBatch 中调用:

Form2 FrmEntry = new Form2();
FrmEntry.ShowDialog();

cmbServiceClassCode.Enabled = false;

I'm not sure to understand your question. From your main form FrmBatch, Call the 2nd form FrmEntry in modal mode. After you Save and close FrmEntry form, you have to disabled combox box. In FrmBatch call this :

Form2 FrmEntry = new Form2();
FrmEntry.ShowDialog();

cmbServiceClassCode.Enabled = false;
七度光 2024-10-08 20:44:01

首先要修复的是

if (true) -> 如果(字符串)

The first thing to fix is

if (true) -> if (str)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文