我已经分配了 2 个 ultracombobox,它们被数据绑定(bind)到一个集合。但是当我更改组合框的值时,集合没有得到反射(reflect)。
但是当我更改第二个组合框的值时,第一个组合框所做的更改会得到反射(reflect),而第二个组合框则不会。
//代码
'DataBinding Declaration
Public Shared ObjLookupHeaderBindings As BindingSource = New BindingSource()
'Binding Asignment
ObjLookupHeaderBindings.DataSource = LookupHeadersCollection
ultraGridBase.DataSource = ObjLookupHeaderBindings
'Collection Class Example code
Public Class LookupHeadersCollection
Public Event LookupSQLCommandChanged As EventHandler
''' <summary>
''' Get or set the SQL Query values
''' </summary>
''' <value></value>
''' <remarks></remarks>
Public Property LookupSQLCommand() As String
Get
Return Me.m_sLookupSQLCommand
End Get
Set(ByVal value As String)
Me.m_sLookupSQLCommand = value
Me.m_bIsChanged = True
RaiseEvent LookupSQLCommandChanged(Me, EventArgs.Empty)
End Set
End Property
End Class
'Add Binding into to controls
cmbSQLServer.DataBindings.Add(New Binding("Text", ObjLookupHeaderBindings, "LookupConnection", False))
cmbDatabaseName.DataBindings.Add(New Binding("Text", ObjLookupHeaderBindings, "LookupDatabaseName", False))
txtSQLCommand.DataBindings.Add(New Binding("Value", ObjLookupHeaderBindings, "LookupSQLCommand", False))
'I tried to the following ways, but its not working.
txtSQLCommand.DataBindings(O).ReadValue()
ObjLookupHeaderBindings.CurrencyManager.Refresh()
我哪里出错了?
最佳答案
添加了DataSource
的UpdateMode
,然后它工作正常。
//代码
cmbSQLServer.DataBindings.Add(New Binding("Text", Controller.ObjLookupHeaderBindings, "LookupConnection", False, DataSourceUpdateMode.OnPropertyChanged))
关于vb.net - 数据绑定(bind)未反射(reflect)在集合中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16960808/