DataSource Set in Form Constructor

2 posts, 1 answers
  1. Andrew Powrie
    Andrew Powrie avatar
    17 posts
    Member since:
    Apr 2007

    Posted 01 Dec 2009 Link to this post

    My program used to be able to access the Item list for a CombBox loaded from a DataTable whilst still in the form Constuctor.  Now it appears that the Item list is not filled in until the Constructor finishes.  If I move the code into a timer event that fires after the Constructor is finished, the Item list is accessable imediately after the DataSource has been set. 

    Has there been a deliberate change to create this situation or should I not be setting DataSources in Constructors?
  2. Answer
    Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 03 Dec 2009 Link to this post

    Hello Andrew,

    Thanks for writing and for your question.

    Q3 2009 release of RadControls for WinForms introduced some improvements in databinding mechanism of RadComboBox. Currently, the Items collection is populated after the Binding Context has been initialized  (which does not happen in the constructor).

    In your case, my suggestion is that you access the combo box items in the OnLoad event of your form or in the BindingContextChanged event of RadComboBox.

    I hope this is helpful. You can write back anytime you need further assistance.

    Kind regards,
    Deyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top