How to pass value of a textbox from one form to another form

前端 未结 6 1650
广开言路
广开言路 2021-01-21 09:06

If I have a value stored into a textbox of form1 and I have to pass that value into an another textbox of another form2. What is the method to do this passing values from one fo

6条回答
  •  一生所求
    2021-01-21 09:27

    In Form1.vb make sure you use an event such as Button.Click and inside that

     Dim obb As New Form2
     obb.val = Me.TextBox1.Text()
     obb.Show()
     Me.Hide()
    

    In Form2.vb use a property called "val"

    Public Property val As String
    

    And on an event like MyBase.Load

    TextBox1.Text = val
    

提交回复
热议问题