Best practice for sharing variables across forms in VB.NET

后端 未结 6 1538
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-07 05:56

I need to share variables across two forms in VB.NET. One of them is the main form and the other is a child form.

I have been searching, and I have found a few metho

6条回答
  •  萌比男神i
    2021-01-07 06:02

    Not sure if this answers the question but one thing I found useful was to refer to the variables in form1 while programming in form2 as Form1.variablename and when in Form1 and referring to variables in Form2 to use in Form1 as Form2.variablename Basically, refer to variables in other forms by putting the name of the form they are in followed by a . and then the variable name

提交回复
热议问题