Hi. I make an instance of a form 'B' from Form 'A'. But I need to pass two variables by reference.
I do what you can see below:
The problem is that Val1 and Val2 keep their own values before calling Form 'B'
I made an example passing an ArrayList and this modify its value when return, but it seems to be that primitives types (boolean, integer, string, etc) does not work by reference in this context.
Other thing I tried is to pass this variables as Object type, but neither works.
Thanks.
I do what you can see below:
Code:
FORM 'B' Private Val1 As Uintenger Private Val2 As Boolean Public Sub New(ByRef _Val1 As Uinteger, ByRef _Val2 As Boolean) InitializeComponent() Val1 = _Val1 Val2 = _Val2 End Sub Private Sub Proceso() Val1 = 333 Val2 = True Me.Close End Sub FORM 'A' Dim FormB As New 'B' (Val1, Val2) FormB.ShowDialog()
I made an example passing an ArrayList and this modify its value when return, but it seems to be that primitives types (boolean, integer, string, etc) does not work by reference in this context.
Other thing I tried is to pass this variables as Object type, but neither works.
Thanks.
Comment