C# - MdiParent StatusStrip [英] C# -- MdiParent StatusStrip
问题描述
大家好..
当我使用MdiChild表格时,如何更改我的MDIParentStatusStrip?我必须从MdiChild表单更改toolStripStatusLabel.text。
我做了一些方法..但是没有工作......
我用过
Hi All..
How can I change my MDIParent "StatusStrip" when I am in a MdiChild FORM ? I have to change toolStripStatusLabel.text from MdiChild form.
I did some ways.. But not working that...
I used
MDI frm =new MDI(txtStatusBarMessage.Text);
MDI表格中的子表单和公共构造函数/>
child form and public constructor in MDI form
public MDI(string StatusbarText)
{
ToolStripStatusLabel ToolStripStatusLabel = new ToolStripStatusLabel();
StatusStrip statusStrip = new StatusStrip();
this.toolStripStatusLabel.Text = objMasterData.GetStatusBarMessage();
statusStrip.Items.Add(ToolStripStatusLabel);
this.Refresh();
}
以另一种方式
in another way
public MDI(string StatusbarText)
{
this.toolStripStatusLabel.Text = objMasterData.GetStatusBarMessage();--> this make an exception "Object reference not set to an instance of an object.".
}
我还为toolStripStatusLabel.Text添加了公共属性。但是没有工作......
请帮帮我...
提前致谢...
Vineetha。 KR
And also i did adding public property for toolStripStatusLabel.Text.but not working that..
please help me...
Thanks in advance...
Vineetha.K.R
推荐答案
从 MDI-Child表格设置状态旅行非常简单
it''s quite simple just set status trip from MDI-Child form
Name of MDI form.toolStripStatusLabel = txtStatusBarMessage.Text;
或
or
((Name of MDI form)(this.MdiParent)).toolStripStatusLabel.Text = txtStatusBarMessage.Text;
您不需要在MDI表格中使用构造函数或任何公共方法
快乐编码!
:)
you need not to use constructor or any public method inside MDI form
Happy Coding!
:)
这篇关于C# - MdiParent StatusStrip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!