public EditGroupForm(string groupName, int groupId) { /* * Used for editing an existing group. */ InitializeComponent(); academicYear = Groups.GetAcademicYear(groupName); staffList = Groups.GetStaff(groupName); Subject = Subjects.GetSubjectName(groupName); this.groupId = groupId; groupNameTextBox.Text = groupName; }
private void GroupsListBox_SelectedValueChanged(object sender, EventArgs e) { if (groupsListBox.SelectedIndex != -1) { string groupName = groupsListBox.SelectedItem.ToString(); int groupIndex = groupsListBox.SelectedIndex; // Make sure there isn't any index selected. This will panic otherwise. selectedGroupLabel.Text = Groups.GroupList[groupIndex]; academicYearLabel.Text = $"Academic Year: {Groups.GetAcademicYear(groupName)}"; // Seperate each lecturer by a line break, \r\n and join each staff. staffListLabel.Text = $"Assigned lecturer(s): {string.Join("\r\n", Groups.GetStaff(groupName))}"; SubjectNameLabel.Text = $"Subject: {Subjects.GetSubjectName(groupName)}"; // These buttons are hidden by default. editClassButton.Show(); deleteClassButton.Show(); } }