我已经分配了2个ultracombobox,它是一个数据集合到一个集合。但是当我改变组合框的值时,集合没有得到反映。
但是当我改变第二个组合框的值时,第一个组合框所做的更改会被反射,第二个组合框则不会被反射。
//代码
'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()
我哪里出错了?
答案 0 :(得分:1)
添加了UpdateMode
的{{1}},然后就可以了。
//代码
DataSource