vb.net - 数据绑定(bind)未反射(reflect)在集合中

标签 vb.net data-binding infragistics ultracombo

我已经分配了 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()

我哪里出错了?

最佳答案

添加了DataSourceUpdateMode,然后它工作正常。

//代码

cmbSQLServer.DataBindings.Add(New Binding("Text", Controller.ObjLookupHeaderBindings, "LookupConnection", False, DataSourceUpdateMode.OnPropertyChanged))

关于vb.net - 数据绑定(bind)未反射(reflect)在集合中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16960808/

相关文章:

python : append/merge dicts to pandas in a pythonic way

javascript - 如何从不同对象范围访问 knockout 可观察量

c# - WPF 文本框和浏览文件 - 是否有更优雅的解决方案?

c# - 在 ContentPresenter 子控件中设置属性

registry - 在键名包含空格的 VB.Net 中获取注册表键值

asp.net - 扩展/重写 System.Net.Mail.SmtpClient Send(message As MailMessage) 方法

c# - 角色和声明之间的区别

vb.net - 什么是事件参数 "sender"和 "e"

c# - 使工具提示区域大于控件

infragistics - 如何在不使用数据集中相关表的情况下在 ultragrid 中获取子波段?