using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Baseline { public partial class frmSettings : Form { private IgnoreLines _MyIgnore; public IgnoreLines MyIgnore { get { return _MyIgnore; } set { _MyIgnore = value; dgv.DataSource=null; //dgvcSearchType.ValueType = typeof(Relation); //dgvcSearchType.ValueMember = "Value"; //dgvcSearchType.DisplayMember = "Display"; //dgvcSearchType.DataSource = new Relation[] { Relation.Contains, Relation.StartsWith, Relation.EndsWith, Relation.Regex } //.Select(x => new { Display = x.ToString(), Value = x }) //.ToList(); dgv.DataSource=value; //dgvcSearchType.DataSource = //new List((Relation[]) Enum.GetValues(typeof(Relation))) //.Select(x => new { Display=x.ToString(), Value=(int)x }) //.ToList();; } } public frmSettings(IgnoreLines myIgnore) { InitializeComponent(); _MyIgnore=myIgnore; } private void frmSettings_Load(object sender, EventArgs e) { dgv.DataSource=MyIgnore; DataGridViewComboBoxColumn col = dgvcSearchType; col.Name = "My Enum Column"; col.DataSource = Enum.GetValues(typeof(Relation)); col.ValueType = typeof(Relation); } private void dgv_DataError(object sender, DataGridViewDataErrorEventArgs e) { Console.WriteLine("Here"); } private void btnOK_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } private void btnCancel_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); } } }