如何使用其他表单在菜单中设置可见性? [英] How Do I Set Visibility In Menus Using Another Form?

查看:82
本文介绍了如何使用其他表单在菜单中设置可见性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我想访问另一个类文件中的表单对象?

所以我按照这样的方法?

但它不起作用?



here i want to access form objects in another class files?
so i followed a method like this?
but it wont work?

VisaInfo VInfo = new VisaInfo();
VInfo.visaMenu2.setVisible(true);





该菜单可见性的当前状态为false。

所以我想从另一个班级设置该菜单的可见性。



请让我知道另一个类中访问表单变量的方式?



current status of that menu visibility is false.
so i want to set visibility of that menu from another class.

please let me know the way of access form variables in another class?

推荐答案

不仅是表单变量,还可以通过简单地公共静态来访问A类到B类的变量。你试过吗?

Not only a form variable, you can access a variable of class A to class B by making it simply public static . Did you try that?
Class A
{ 
   public static int a=0;
}

Class B
{
   public void yourMethod(){
   A.a = 10;
   }
}


这篇关于如何使用其他表单在菜单中设置可见性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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