private void BtnEdit_Click(object sender, EventArgs e) { Activity_DAO activity_dao = new Activity_DAO(); int activityUpId = 0; for (int i = 0; i < activityListView.Items.Count; i++) { if (activityListView.Items[i].Checked) { activityUpId = int.Parse(activityListView.Items[i].Text); } } activity_dao.updateActivityById(activityUpId, tboxName.Text, dateTimePickerStart.Value, dateTimePickerEnd.Value); refreshActivities(); }