Пример #1
0
        /// <summary>
        /// Data Grid Cell End Edit Event: Sets the EditItem value
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvEditField_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string id = dgvEditField["chID", e.RowIndex].Value.ToString();
                string v;
                if (dgvEditField["chValue", e.RowIndex].Value != null)
                {
                    v = dgvEditField["chValue", e.RowIndex].Value.ToString();
                }
                else
                {
                    v = "";
                }

                EditItem item = Items.Find(delegate(EditItem i) { return(i.ComponentID == id); });
                Items.Remove(item);
                item.NewValue = v;
                Items.Add(item);
            }
            catch (Exception ex)
            {
                Log.LogException(ex).ShowDialog();
            }
        }
Пример #2
0
 /// <summary>
 /// Initialization Code: Takes a list of list view items that were selected for editing.
 /// </summary>
 /// <param name="lvis">The list view item list</param>
 public frmEditField(List <ListViewItem> lvis)
 {
     InitializeComponent();
     try
     {
         foreach (ListViewItem lvi in lvis)
         {
             List <object> objs = new List <object>();
             for (int i = 0; i < lvi.SubItems.Count; i++)
             {
                 objs.Add(lvi.SubItems[i].Text);
             }
             EditItem item = new EditItem(lvi.Text);
             item.OldValue = lvi.SubItems[2].Text;
             item.NewValue = lvi.SubItems[2].Text;
             Items.Add(item);
             dgvEditField.Rows.Add(objs.ToArray());
         }
         if (dgvEditField.Rows.Count > 0)
         {
             dgvEditField.CurrentCell = dgvEditField[2, 0];
         }
     }
     catch (Exception ex)
     {
         Log.LogException(ex).ShowDialog();
     }
 }