【问题标题】:DataBindings not reflecting in collectionsDataBindings 未反映在集合中
【发布时间】:2013-06-06 11:19:59
【问题描述】:

我已经分配了 2 个超组合框,它们被数据绑定到一个集合。但是,当我更改组合框的值时,集合并没有得到反映。

但是当我更改第二个组合框的值时,第一个组合框所做的更改会得到反映,而第二个则不会。

//代码

'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()

我哪里出错了?

【问题讨论】:

    标签: vb.net data-binding infragistics ultracombo


    【解决方案1】:

    DataSource 中添加UpdateMode 然后它工作正常。

    //代码

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-05
      • 2018-05-13
      • 1970-01-01
      相关资源
      最近更新 更多