Home All Groups Group Topic Archive Search About

Unable to use Property instead of Sub in Thread

Author
1 Apr 2006 1:44 PM
Allen
The code below appears in my thread code.

I'm unable to use WriteOnly Property because of signature unmatch.

WriteOnly Property ButtonAbortFolderVisible() As Boolean' does not have the
same signature as delegate 'Delegate Sub SetBooleanCallback(value As
Boolean)

Is there any way around that?

Thanks

Public Sub ButtonAbortFolderVisible(ByVal value As Boolean)

If mFormForAbort.ButtonAbortFolder.InvokeRequired Then

Dim d As New SetBooleanCallback(AddressOf ButtonAbortFolderVisible)

mFormForAbort.ButtonAbortFolder.Invoke(d, New Object() {value})

Else

mFormForAbort.ButtonAbortFolder.Visible = value

snip...

End If

End If

End Sub

Author
1 Apr 2006 2:43 PM
Branco Medeiros
Allen wrote:
<snip>
> I'm unable to use WriteOnly Property because of signature unmatch.
>
> WriteOnly Property ButtonAbortFolderVisible() As Boolean' does not have the
> same signature as delegate 'Delegate Sub SetBooleanCallback(value As
> Boolean)
>
> Is there any way around that?
<snip>

Unfortunately, nope. It seems to me that a Delegate can only be a
Function or a Sub.

If you want to expose a Property, then you may make it 'delegate' to
the actual method that aborts the folder:

Public WriteOnly Property ButtonAbortFolderVisible() As Boolean
Set(Value As Boolean)
  DoAbortFolderVisible(Value)
End Set
End Property

Regards,

Branco.
Author
1 Apr 2006 6:39 PM
Allen
thanks for the info


Show quoteHide quote
"Branco Medeiros" <branco.medei***@gmail.com> wrote in message
news:1143902623.268377.240120@j33g2000cwa.googlegroups.com...
> Allen wrote:
> <snip>
>> I'm unable to use WriteOnly Property because of signature unmatch.
>>
>> WriteOnly Property ButtonAbortFolderVisible() As Boolean' does not have
>> the
>> same signature as delegate 'Delegate Sub SetBooleanCallback(value As
>> Boolean)
>>
>> Is there any way around that?
> <snip>
>
> Unfortunately, nope. It seems to me that a Delegate can only be a
> Function or a Sub.
>
> If you want to expose a Property, then you may make it 'delegate' to
> the actual method that aborts the folder:
>
> Public WriteOnly Property ButtonAbortFolderVisible() As Boolean
> Set(Value As Boolean)
>  DoAbortFolderVisible(Value)
> End Set
> End Property
>
> Regards,
>
> Branco.
>
Author
1 Apr 2006 6:56 PM
Allen
Is the following correct?

SetBooleanCallback is a class (it is called a delegate only because classes
reference functions are called delegates)

from

Dim d As New SetBooleanCallback(AddressOf ButtonAbortFolderVisible)

d is an instance of that class that references ButtonAbortFolderVisible

I not sure of what I'm saying so if there is a better way to say it, it may
make it clearer.


Thanks again

Show quoteHide quote
"Branco Medeiros" <branco.medei***@gmail.com> wrote in message
news:1143902623.268377.240120@j33g2000cwa.googlegroups.com...
> Allen wrote:
> <snip>
>> I'm unable to use WriteOnly Property because of signature unmatch.
>>
>> WriteOnly Property ButtonAbortFolderVisible() As Boolean' does not have
>> the
>> same signature as delegate 'Delegate Sub SetBooleanCallback(value As
>> Boolean)
>>
>> Is there any way around that?
> <snip>
>
> Unfortunately, nope. It seems to me that a Delegate can only be a
> Function or a Sub.
>
> If you want to expose a Property, then you may make it 'delegate' to
> the actual method that aborts the folder:
>
> Public WriteOnly Property ButtonAbortFolderVisible() As Boolean
> Set(Value As Boolean)
>  DoAbortFolderVisible(Value)
> End Set
> End Property
>
> Regards,
>
> Branco.
>