如何使用另一个表单中的文本框分配变量的值?

时间:2017-09-28 03:13:20

标签: vb.net

这是我的代码

form1:

public sometext as string

form2:

 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click  
        textbox1.text = form1.sometext  
    End Sub

1 个答案:

答案 0 :(得分:0)

表格1:

Dim Obj as New Form2
Obj.Str = 'some variable in form 1'
Obj.Show
Me.Hide

表格2:

Public Property Str as String
Textbox1.text = Str

有关详细信息,请查看以下链接:How to pass value of a textbox from one form to another form