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

前端 未结 6 1697
广开言路
广开言路 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:37

    if both the forms are running, then you can use

     form2.TextBox1.Text=form1.TextBox1.Text
    

    Else you can declare a Public String variable in Form2, on any event,

    dim Obj as new Form2
    Obj.StrVariable=Me.TextBox1.Text
    Obj.Show
    

    and on Form2 Load,

    Me.TextBox1.Text=StrVariable
    

提交回复
热议问题