private void buttonEdit_Click(object sender, EventArgs e) { if (listViewAgents.SelectedItems.Count == 1) { AgentsSet agentsSet = listViewAgents.SelectedItems[0].Tag as AgentsSet; agentsSet.FirstName = textBoxFirstName.Text; agentsSet.MiddleName = textBoxMiddleName.Text; agentsSet.LastName = textBoxLastName.Text; agentsSet.PhoneNumber = textBoxPhone.Text; agentsSet.Position = comboBoxPosition.Text; Program.wftDb.SaveChanges(); ShowAgent(); } }