private void AddRow(Model.ClientButton model) { var rowIndex = dataGridView1.Rows.Add(); var row = dataGridView1.Rows[rowIndex]; row.Cells["Type"].Value = model.Type.ToString(); row.Cells["Message"].Value = model.Message; dataGridView1.CurrentCell = row.Cells[0]; dataGridView1.BeginEdit(false); }
public void SaveData() { var list = new List<Model.ClientButton>(); foreach (DataGridViewRow row in dataGridView1.Rows) { try { var model = new Model.ClientButton { Type = (ClientButtonType)Enum.Parse(typeof(ClientButtonType), row.Cells["Type"].Value.ToString()), Message = row.Cells["Message"].Value.ToString() }; list.Add(model); } catch { } } DataManager.Save(list); }
public void SaveData() { var list = new List <Model.ClientButton>(); foreach (DataGridViewRow row in dataGridView1.Rows) { try { var model = new Model.ClientButton { Type = (ClientButtonType)Enum.Parse(typeof(ClientButtonType), row.Cells["Type"].Value.ToString()), Message = row.Cells["Message"].Value.ToString() }; list.Add(model); } catch { } } DataManager.Save(list); }