Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Making ToolStripStatusLabel data bindable

I have tried to create a customised ToolStripStatusLabel control to make it
databound. I have implemented it as in VB as below but, although I believe I
have matched the method signatures correctly I am getting these errors:

"Error 1 Class 'BindableToolStripStatusLabel' must implement 'Property
BindingContext() As BindingContext' for interface
'System.Windows.Forms.IBindableComponent'. Implementing property must have
matching 'ReadOnly' or 'WriteOnly' specifiers. "

"Error 2 Class 'BindableToolStripStatusLabel' must implement 'ReadOnly
Property DataBindings() As ControlBindingsCollection' for interface
'System.Windows.Forms.IBindableComponent'. Implementing property must have
matching 'ReadOnly' or 'WriteOnly' specifiers."

What am I doing wrong?

Public Class BindableToolStripStatusLabel
Inherits ToolStripStatusLabel
Implements IBindableComponent

Private _context As BindingContext = Nothing
Private _bindings As ControlBindingsCollection

Public Property BindingContext() As BindingContext
Get
If Nothing Is _context Then
_context = New BindingContext()
End If
Return _context
End Get
Set(ByVal value As BindingContext)
_context = value
End Set
End Property

Public ReadOnly Property DataBindings() As ControlBindingsCollection
Get
If _bindings Is Nothing Then
_bindings = New ControlBindingsCollection(Me)
End If
Return _bindings
End Get
End Property

End Class

Thanks.
[1888 byte] By [mjtech] at [2007-11-11 8:50:01]
# 1 Re: Making ToolStripStatusLabel data bindable
To answer my own question, the methods should have been declared thus:

Public Property BindingContext() As BindingContext Implements IBindableComponent.BindingContext

and

Public ReadOnly Property DataBindings() As ControlBindingsCollection Implements IBindableComponent.DataBindings
mjtech at 2007-11-11 21:46:58 >