private void DisplayObject(object sender, EventArgs e) { DataGridViewRow row = (dataGridView1.SelectedRows.Count > 0 ? dataGridView1.SelectedRows[0] : dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex]); OMKey key = new OMKey((string)row.Cells[0].Value, (string)row.Cells[1].Value, (int)row.Cells[2].Value); ObjectDisplayForm odf = new ObjectDisplayForm(key.ToString()); odf.Show(); }
private static string Add(string name, object o, int c) { OMKey key = new OMKey(name, o.GetType().Name, c); if (OM.ContainsKey(key)) { return(Add(name, o, ++c)); } else { OM.Add(key, o); return(key.ToString()); } }
// To make value comparisons work. public override bool Equals(object obj) { OMKey other = obj as OMKey; return(other != null && other.ToString() == this.ToString()); }
private void DeleteObject(object sender, DataGridViewRowCancelEventArgs e) { OMKey key = new OMKey((string)e.Row.Cells[0].Value, (string)e.Row.Cells[1].Value, (int)e.Row.Cells[2].Value); XLOM.Remove(key.ToString()); }