Exemplo n.º 1
0
 //custom event handler for ModifyObject
 private void HandleModifyObject(object sender, ModifyObjectEventArgs e)
 {
     //make the selected listview item equal to the passed through updated object from the dialog form.
     spaceshipListView.SelectedItems[0].Text       = e.ModifyObject1.ToString();
     spaceshipListView.SelectedItems[0].ImageIndex = e.ModifyObject1.ImageIndex;
     spaceshipListView.SelectedItems[0].Tag        = e.ModifyObject1;
 }
Exemplo n.º 2
0
 //Custom event arg handler for when modifying an object in the listview
 public void HandleModifyObject(object sender, ModifyObjectEventArgs e)
 {
     //update the database with the new data
     UpdateDatabase(e.ModifyObject1.UserId, e.ModifyObject1.FName, e.ModifyObject1.LName, e.ModifyObject1.OccupId, e.ModifyObject1.Gender);
     //update the listview with the new objects data
     personListView.SelectedItems[0].Tag        = e.ModifyObject1;
     personListView.SelectedItems[0].Text       = e.ModifyObject1.ToString();
     personListView.SelectedItems[0].ImageIndex = e.ModifyObject1.ImageIndex;
 }
Exemplo n.º 3
0
        // create the ModifyObject to update the ListView
        public void ModifyObject(object sender, ModifyObjectEventArgs e)
        {
            Data d = e.ObjectToModify1.Tag as Data;

            d.Title = textBoxTitle.Text;
            d.Genre = textBoxGenre.Text;
            d.Year  = numericUpDownYear.Value;
            d.Price = numericUpDownPrice.Value;

            e.ObjectToModify1.Text       = d.ToString();
            e.ObjectToModify1.ImageIndex = 0;
            e.ObjectToModify1.Tag        = d;
        }