dotnet windows forms databinding:
Hi,
I have a custom control which consists of a combobox(simple) and a button.
The custom control performs a lookup/search function.
How can I create a datasource that is exposed for when I place the control
on a form?
The only thing I've really been able to find is a code-snippet to expose the
properties:
<Bindable(True), _
DefaultValue(""), _
Category("Data"), _
Description("The data source used to build up the control."), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
_
Public Property DataSource() As Object
Get
Return _dataSource
End Get
Set(ByVal Value As Object)
If (Value Is Nothing) Or (TypeOf Value Is IListSource) Or
(TypeOf Value Is IEnumerable) Then
_dataSource = Value
Else
Throw New Exception("Invalid datasource.")
End If
End Set
End Property
<Bindable(True), _
DefaultValue(""), _
Category("Data"), _
Description("select a particular field from the default or selected
table.")> _
Public Property DisplayMember() As String
Get
Return _dataDisplayMember
End Get
Set(ByVal Value As String)
_dataDisplayMember= Value
End Set
End Property
<Bindable(True), _
DefaultValue(""), _
Category("Data"), _
Description("The table from within the selected data source.")> _
Public Property ValueMember() As String
Get
Return _dataValueMember
End Get
Set(ByVal Value As String)
_dataValueMember= Value
End Set
End Property
However, that doesn't 'handle' the properties, just makes them visible.
This is for a windows application and while I think I can use the
IDataSourceProvider interface if this was web,
how can I do this under VB.NET?
Seriously need help with this, I've spent way too much time on an issue that
I thought was going to be simple.
Thanks in advance,
Christopher Klein