CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011
    Posts
    6

    [RESOLVED] DefaultView.Sort is resetting

    Hi all,

    I need help with this code:
    Code:
    DataAdapter1.Fill(DataSet1);
    DataSet1.Tables[0].DefaultView.Sort = "sortcolumn";
    BindingSource1.DataSource =  DataSet1.Tables[0].DefaultView;
    After execution, the "DataSet1.Tables[0].DefaultView.Sort" property is reset to empty string.
    What might be the cause of this, and how can this be avoided?

    Thanks

  2. #2
    Join Date
    Mar 2011
    Posts
    6

    Re: DefaultView.Sort is resetting

    The problem was that in the designer window, when I previously set the Sort property of the BindingSource to some value, and then later I deleted it, the designer was initializing it's value to an empty string, not to null, which was causing the problem.
    I just deleted the initialization for the Sort property from the designer code (I suppose you can't set the value to null from the designer window).
    The issue is solved.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts



HTML5 Development Center

Click Here to Expand Forum to Full Width