无法访问 [英] sub inaccessible

查看:96
本文介绍了无法访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述








在我的项目中有form1和form2    ;在form1中有一个工具标签;当我点击它时,子xxx()应该执行一个简单的任务。 Sub xxx()已经在form2中被公式化为public并且它在form2中正确地工作,但是在运行它时
在form1中给出错误:未声明xxx()。由于其保护级别,它可能无法访问。我已经习惯了VB6,我不知道如何着手。


解决方案
Form1中需要Form2的实例 您必须在某处向用户显示Form2。 在代码中,您应该捕获对Form2实例的引用。 然后,您可以使用该引用来访问公共方法。


In my project there are form1 and form2   ; In form1 there is a toolstriplabel; when i click on it a sub xxx() should execute a simple task. Sub xxx() as been deifined in form2 as Public and it works correctely in form2, but in running it gives error in form1: "xxx() is not declared. It may be inaccessible due to its protection level". I'm used to VB6 and i do not know how to proceed.



解决方案

Form1 needs an instance of Form2.  Somewhere you must have shown Form2 to the user.  At that point in your code you should capture a reference to that instance of Form2.  You can then use that reference to access the public method.


这篇关于无法访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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