David Smith

David Smith

  • NA
  • 2k
  • 0

BindingSource index position

Jul 8 2011 11:08 PM
I am basically doing a  search against the binding source so that i can set the active row. Can some give me assistance. I get set the binding source with current position. One I recieve the binding source position , i can set the active row on the ultragrid with the value of the binding source position. For some reason it keep giving me the position 0



 private void UserSearchUltraTextEditor_ValueChanged_1(object sender, EventArgs e)
    {
      string userNameToFind = UserSearchUltraTextEditor.Text;

      this.ultraGrid1.ActiveRow = null;

      foreach (var user in this.userDataSet.ApprovedPersonnel)
      {
        if (user.UserName.StartsWith(userNameToFind, true, System.Globalization.CultureInfo.CurrentCulture))
        {
          BindingSource.Position =  this.BindingSource.IndexOf(user);  //  This line is setting the position to 0 everytime which is false

          this.ultraGrid1.ActiveRow = this.ultraGrid1.Rows[BindingSource.Position];
          break;
        }
      }
    }