Datasource Changed

4 posts, 0 answers
  1. Alexandre
    Alexandre avatar
    26 posts
    Member since:
    Feb 2008

    Posted 06 Dec 2010 Link to this post

    Hi i'm curetly overriding your Multicolumn control to apply sepcifics actions nedded by my application. I'm working to stop the selectedindexchanged event when changing the datasource property. I tried overriding databindingcomplete event to detect when datasource changed but this event is fired after selectedindexchanged event. My plan was to set a bool flag to true when the datasource changed to prevent selectedindexchange fire. Do there is an other way to make this hapen?

    Thanks

    Alexandre Samson
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 06 Dec 2010 Link to this post

    Hello,

    the simplest way is to remove the event handler, and then add it back in again.
    E.g.

    RemoveHandler Me.RadMultiColumnComboBox1.SelectedIndexChanged, AddressOf MultiColumnComboSelectedIndexChanged
    ' do stuff with data source
    ' re-select a value
    AddHandler Me.RadMultiColumnComboBox1.SelectedIndexChanged, AddressOf MultiColumnComboSelectedIndexChanged

    hope that helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Alexandre
    Alexandre avatar
    26 posts
    Member since:
    Feb 2008

    Posted 07 Dec 2010 Link to this post

    I just made a custom class who is inheting MultiColumnCombobox class and overloaded the datasource property like this:

    Private m_Bind As Boolean
     Protected Overrides Sub OnSelectedIndexChanged(ByVal e As System.EventArgs)
         If Not m_Bind  Then
             MyBase.OnSelectedIndexChanged(e)
         End If
     End Sub
     Public Overloads Property DataSource() As Object
         Get
             Return MyBase.DataSource
         End Get
         Set(ByVal value As Object)
             m_Bind = True            
             MyBase.DataSource = value
             m_Bind = False
         End Set
     End Property

    That's work.
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 07 Dec 2010 Link to this post

    Hello, 

    Glad that you found a suitable way to solve your issue. 
    Best regards, 
    Richard
Back to Top