这是调用表单并在面板内部显示时的代码
Dim frmLubesInterface As LubesInterface = New LubesInterface
with frmLubesInterface
.Text = "frmLubesInterface"
.TopLevel = False
Panel6.Controls.Add(frmLubesInterface)
.StartPosition =
.FormStartPosition.CenterScreen
.Show()
end with
这是代码,用于传递来自表单的数据并显示在面板内部的表单内部
Dim Itemname as string = ""
Itemname = txtItemNameSearch.Text
LubesInterface.txtItem.Text = Itemname - **this part is where i pass the value of data to form textbox inside panel**
总而言之,我无法将文本框的值传递给面板内的表单文本框,但是当将其显示为msgbox时会显示该值。
答案 0 :(得分:0)
我已经知道了。我应该声明全局并在面板内调用表格。
答案 1 :(得分:0)
我不确定您所说的“全球”是什么意思,这个意思似乎与不同的人有所不同。
就我而言,您可以采用以下两种方法之一进行操作,既可以将值传递给构造函数,也可以创建属性并获取/设置这些属性。
Public Class Form1
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
Dim TxtFromTxtBoxOnForm2 As String = String.Empty
Dim Form2 As New Form2
With Form2
TxtFromTxtBoxOnForm2 = .ItmTxt
.TopLevel = False
.StartPosition = FormStartPosition.Manual
Panel1.Controls.Add(Form2)
.Show()
End With
End Sub
End Class
Public Class Form2
Public Property ItmTxt As String
Get
Return TextBoxOnForm2.Text
End Get
Set(value As String)
TextBoxOnForm2.Text = value
End Set
End Property
End Class