frmMain
昏暗B = frmSearch.A 但每当我检查B的值时,它总是返回一个空白字符串 当我检查frmSearch.A的值时它也没有返回任何内容,即使它在我在frmSearch中检查它时返回一个值
请帮助我真的卡住了 提前谢谢答案 0 :(得分:1)
访问表单的字段应该不是问题。只需确保在您阅读该字段时已经分配了它。
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim form = New Form2
Debug.Assert(form.A Is Nothing)
form.ShowDialog()
Debug.WriteLine(form.A(0))
End Sub
End Class
Public Class Form2
Public A As String()
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
A = {"abc", "aaa"}
End Sub
End Class