private void editLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { EditTask edit = new EditTask(assignment); DialogResult dialog = edit.ShowDialog(); if (dialog != DialogResult.OK) { return; } // Make these local vars to prevent "marshal-by-reference" classes - https://stackoverflow.com/questions/4178576/accessing-a-member-on-form-may-cause-a-runtime-exception-because-it-is-a-field-o int newScore = edit.newScore; DateTime newDueDate = edit.newDueDate; Dictionary <string, string> formData = new Dictionary <string, string> { { "title", edit.newTitle }, { "description", edit.newDescription }, { "max_score", newScore.ToString() }, { "date_due", newDueDate.ToString("dd/MM/yyyy|HH:mm") } }; APIHandler.EditAssignment(assignment, formData); ParentRefreshList(); MessageBox.Show("Edited task successfully!"); }