0

我正在完成的 VB.net 程序存在以下问题。基本上我有两种形式。Form1技术人员。表格 1 首先加载,是我的“主”页面。我想在Form1上引用 techs 中的变量。我公开声明了这个变量:

 Public jobID As String

然后我在 Form1 上这样引用它:

暗淡作业作为字符串 = 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.'

谁能告诉我这里出了什么问题?

4

2 回答 2

1

尝试改变

Public jobID As String

Public Shared jobID As String
于 2012-11-23T00:42:05.710 回答
1

实例化第一技术

Dim newtechs As New techs()

然后,将 techs.jobID 分配给 Form1 下的字符串变量

Dim job As String = newtechs.jobID
于 2012-11-23T00:55:14.447 回答