【发布时间】:2012-11-23 00:24:48
【问题描述】:
我正在完成的 VB.net 程序存在以下问题。基本上我有两种形式。 Form1 和 techs。表格 1 首先加载,是我的“主”页面。我想在 Form1 上引用技术中的变量。我公开声明了这个变量:
Public jobID As String
然后我在 Form1 上这样引用它:
Dim job As String = techs.jobID
这是我得到的错误:
An error occurred creating the form. See Exception.InnerException for details. The error is: An error occurred creating the form. See Exception.InnerException for details. The error is: The form referred to itself during construction from a default instance, which led to infinite recursion. Within the Form's constructor refer to the form using 'Me.'
谁能告诉我这里出了什么问题?
【问题讨论】:
-
你能展示一下techs的构造函数吗?即创建第二种形式的实例的代码。
-
事实上,考虑到这一点,我认为问题在于技术人员将其引用为在被引用之前尚未构造的变量。
-
必须先实例化技术
-
请将内部异常中的文本添加到您的问题中,因为我无法重现您的问题!