I want pass data from main form to child form.
I am getting an error 'Delegate 'Test.Form1.SetParameterValueDelegate' requires an 'AddressOf' expression or lambda expression as the only argument to its constructor.
below is my code
'Main Form (Main Form)
Public Class Form1
'Declare delagete callback function, the owner of communication
Public Delegate Sub SetParameterValueDelegate(ByVal value As String)
Public Delegate Sub AddItemDelegate(ByVal item As String)
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim frm as Form2 = New Form2()
Me.SetParameterValueCallback += New SetParameterValueDelegate(frm.SetParamValueCallbackFn)
frm.Show()
End Sub
' This event creates our second form, says "attach its MessageReceived function to the event"
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'SetParameterValueCallback("dfdf")
End Sub
End Class
'Child Form (Form2)
Public Sub SetParamValueCallbackFn(ByVal param As String)
ListBox1.Items.Add(param)
End Sub