|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unable to use Property instead of Sub in ThreadI'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 Allen wrote:
<snip> > I'm unable to use WriteOnly Property because of signature unmatch. <snip>> > 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? 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. 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. > 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. > |
|||||||||||||||||||||||