private void btnTest_Click() { textbox.CloseIntellisense(); ExpressionTree et = new ExpressionTree(ExpressionTree.CleanExpression(textbox.ToString())); ExpressionTree.ValidationError ve = et.Compile(); if (ve == ExpressionTree.ValidationError.Valid) { bool sorted; var v = et.Filter(Database.LibrarySnapshot, out sorted); string message; if (v.Count == 1) { message = String.Format("Playlist returns {0} track.", v.Count.ToString()); } else { message = String.Format("Playlist returns {0} tracks.", v.Count.ToString()); } QMessageBox.Show(this, message, "Auto Playlist Test", QMessageBoxIcon.Information); } else { QMessageBox.Show(this, getValidationErrorText(ve), "Auto Playlist Test Failed", QMessageBoxIcon.Information); } }