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

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

    You could use the button1_click and state there:

    Dim obj as new form2
    Obj.pass=me.textbox1.text
    
    Obj.show()
    

    Then in your form2 before your form2 main class you state:

    Public property pass as string 
    

    On the load state

    Textbox1.text=pass

    Now, when you click on the button on form1, form2 will show and the textbox1 on form2 will have the same text as the one in form1. Provided you use this only with text box, labels or other kind of STRING or will work.

提交回复
热议问题