首页 > 解决方案 > 在子窗口 VB.NET 2015 中访问 MDI 父 StatusStrip

问题描述

VB.NET 2015 - 在 MDI 窗口中放置了带有 2 个 ToolStripStatusLabel 的 StatusStrip 控件。当我打开一个新表单时,这将是 MDI 窗口的子级。

我如何从信息 ToolStripStatusLabel 中读取信息。

For Each 不会遍历 StatusStrip 中的所有项目,并且据我所知,ToolStripStatusLabel 本身不是一个控件,因此 For each 循环不起作用。

出于与上述相同的原因,Me.Owner.Controls 也无法访问 ToolStripStatusLabel

该怎么办 ?

标签: vb.net

解决方案


jmcilhinney 的事件方法绝对是一种更好的方法,但是作为一种快速解决方案,My命名空间可以在 VB.Net 中使用。

My.Forms.<Form Name>.<Control name>.<property>

例如:

My.Forms.AM_MDI.ToolStripStatusLabel1.Text

对于那些喜欢阅读更多关于我的命名空间的人 - VB.NET 中的命名空间 https://www.thoughtco.com/namespaces-in-vbnet-3424445

您在 VB.NET 中使用“我的”命名空间吗? 您在 VB.NET 中使用“我的”命名空间吗?


推荐阅读