private void LoadPatternsButton_Click(object sender, System.EventArgs e) { if (DialogResult.OK == openFileDialog1.ShowDialog()) { object repc = ValidationUtil.XmlStringToObject( ValidationUtil.FileToString(openFileDialog1.FileName), typeof(RegExPatternCollection)); this._RegExPatterns = repc as RegExPatternCollection; if (repc != null) { this.RegExPatternsDropDownList.DataSource = this._RegExPatterns; this.RegExPatternsDropDownList.DisplayMember = "PatternName"; this.RegExErrorMessageTextBox.DataBindings.Add("Text", this._RegExPatterns, "ErrorMessage"); this.RegExPatternTextBox.DataBindings.Add("Text", this._RegExPatterns, "Pattern"); this.RegExTestValueTextBox.DataBindings.Add("Text", this._RegExPatterns, "TestValue"); } } }