By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,475 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Unable to use Property instead of Sub in Thread

P: n/a
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
Apr 1 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

Apr 1 '06 #2

P: n/a
thanks for the info
"Branco Medeiros" <br*************@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.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.

Apr 1 '06 #3

P: n/a
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

"Branco Medeiros" <br*************@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.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.

Apr 1 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more Visual Basic .NET Questions on Bytes