There is frequently a need to pass a value between two Windows Forms.
The code below provides an example of how this can be accomplished in Visual Basic .NET creating the property below in the form you wish to pass a value to.
Public Property passedVariable() As String Get Return nameform End Get Set(ByVal value As String) nameform = value End SetEnd PropertyPrivate nameform As String
Textbox1.Text=passedVariableOnce an instance of the form is created we can then assign the property the value we wish to pass into the form as show below.
Dim f1 As New Form1f1.passedVariable = "test"The result will be that the textbox1 in form1 will show test.
No comments:
Post a Comment