如何保存子表单数据时更新MDI控件? [英] How do I update MDI control when child form data save ?

查看:61
本文介绍了如何保存子表单数据时更新MDI控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的MDI表单中有一个方法,当子表单保存数据时它将更新MDI Control。



我尝试过:



 public delegate void ShowAlert(string Message,AlertNotification alertType); 
public void ShowAlertOnStatusBar(string Message,AlertNotification alertType)
{
switch(alertType)
{
case AlertNotification.success:
this.Name = Message ;
this.toolNotificationStatusLabel1.Text = string.Empty;
toolNotificationStatusLabel1.Text =消息;
toolNotificationStatusLabel1.ForeColor = Color.Green;
休息;
case AlertNotification.error:
toolNotificationStatusLabel1.Text = Message;
toolNotificationStatusLabel1.ForeColor = Color.Red;
休息;
case AlertNotification.info:
toolNotificationStatusLabel1.Text = Message;
toolNotificationStatusLabel1.ForeColor = Color.SkyBlue;
休息;
}
}

解决方案

让您的子表格提出以MDI格式处理的事件:< a href =https://www.codeproject.com/Tips/548131/Transferring-information-between-two-forms-Part>在两个表格之间传递信息,第2部分:孩子到父母 [ ^ ]向您展示如何

I have a method in my MDI form when ever child form save data it will update MDI Control.

What I have tried:

 public delegate void ShowAlert(string Message,AlertNotification alertType);
public void ShowAlertOnStatusBar(string Message,AlertNotification alertType)
        {
            switch(alertType)
            {
                case AlertNotification.success:
                    this.Name = Message;
                    this.toolNotificationStatusLabel1.Text = string.Empty;
                    toolNotificationStatusLabel1.Text = Message;
                    toolNotificationStatusLabel1.ForeColor = Color.Green;
                    break;
                case AlertNotification.error:
                    toolNotificationStatusLabel1.Text = Message;
                    toolNotificationStatusLabel1.ForeColor = Color.Red;
                    break;
                case AlertNotification.info:
                    toolNotificationStatusLabel1.Text = Message;
                    toolNotificationStatusLabel1.ForeColor = Color.SkyBlue;
                    break;
            }
        }

解决方案

Have your child form raise an event which is handled in the MDI form: Transferring information between two forms, Part 2: Child to Parent[^] shows you how.


这篇关于如何保存子表单数据时更新MDI控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆