G
Guest
Simplified.
I have 2 forms running on seperate threads (and message queues)
I am having some odd problems with with the form on the second
Thread/message queue freezing and/or dyinig, seemingly at random.
I have been carfull always to call Form2.Invoke(someDelegate) Whenever I
want to access a method on the second form from the first.
I have tracked down 1 remaining occurence Where from 1 wants to disable a
button on form 2
Public Class Form 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form2.ButtonClose.Enabled = Flase
End Class
I think that this may be the cause of my problems. I am having trouble
however defining a delegate to pass to Form2.ButtonClose.Invoke
Public Class Form 1
Private Delegate Function EnableCloseGet() As Boolean
Private Delegate Sub EnableCloseSet(ByVal Value as Boolean)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' I have tried both of these
'1
Dim _EnableCloseGetDelegate As New EnableClose(AddressOf
Me.ButtonClose.Enabled)
Form2.ButtonClose.Invoke(_EnableCloseGetDelegate)
'2
Dim _EnableCloseSetDelegate As New EnableCloseSet(AddressOf
Form2.ButtonClose.Enabled)
Dim _args() As Object = {False}
Form2.ButtonClose.Invoke(_EnableCloseSetDelegate, _args)
End Class
Both approaches give me compile errors respectively
"Method 'Public Property Enabled() As Boolean' does not have the same
signature as delegate 'Delegate Function EnableCloseGet() As Boolean'."
"Method 'Public Property Enabled() As Boolean' does not have the same
signature as delegate 'Delegate Sub EnableCloseSet(Value As Boolean)'."
Where am I going wrong please. is there a special type of delegate that I
need to use or sometinig?
Ben
I have 2 forms running on seperate threads (and message queues)
I am having some odd problems with with the form on the second
Thread/message queue freezing and/or dyinig, seemingly at random.
I have been carfull always to call Form2.Invoke(someDelegate) Whenever I
want to access a method on the second form from the first.
I have tracked down 1 remaining occurence Where from 1 wants to disable a
button on form 2
Public Class Form 1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Form2.ButtonClose.Enabled = Flase
End Class
I think that this may be the cause of my problems. I am having trouble
however defining a delegate to pass to Form2.ButtonClose.Invoke
Public Class Form 1
Private Delegate Function EnableCloseGet() As Boolean
Private Delegate Sub EnableCloseSet(ByVal Value as Boolean)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' I have tried both of these
'1
Dim _EnableCloseGetDelegate As New EnableClose(AddressOf
Me.ButtonClose.Enabled)
Form2.ButtonClose.Invoke(_EnableCloseGetDelegate)
'2
Dim _EnableCloseSetDelegate As New EnableCloseSet(AddressOf
Form2.ButtonClose.Enabled)
Dim _args() As Object = {False}
Form2.ButtonClose.Invoke(_EnableCloseSetDelegate, _args)
End Class
Both approaches give me compile errors respectively
"Method 'Public Property Enabled() As Boolean' does not have the same
signature as delegate 'Delegate Function EnableCloseGet() As Boolean'."
"Method 'Public Property Enabled() As Boolean' does not have the same
signature as delegate 'Delegate Sub EnableCloseSet(Value As Boolean)'."
Where am I going wrong please. is there a special type of delegate that I
need to use or sometinig?
Ben