private void Button_Add_Group_Click(object sender, EventArgs e) { NameList <Student> newGroup = new NameList <Student>(); m_InputNewName.Text = "Enter New Name of Group"; m_InputNewName.isEdit = false; string buf = ""; int select = getGroupSelect(); if (select != ListBox.NoMatches) { buf = ListBox_List_Groups.GetItemText(ListBox_List_Groups.SelectedItem); } if (m_InputNewName.ShowDialog() == DialogResult.OK) { newGroup.nameList = m_InputNewName.nameOfTheList; m_Faculty.pushInSortList(newGroup); setGroupActions(true); setStudentActions(true); setSelectedActions(false); Button_Delete_All_Students_In_Group.Enabled = false; Button_Delete_All_Groups.Enabled = true; } showGroups(); if (buf.Length > 0) { ListBox_List_Groups.SelectedIndex = ListBox_List_Groups.FindString(buf, -1); ListBox_List_Groups_SelectedIndexChanged(sender, e); } }
private void TextBox_Edit_Group_TextChanged(object sender, EventArgs e) { int index = ListBox_List_Groups.FindString(((TextBox)(sender)).Text); if (index != ListBox.NoMatches && ((TextBox)(sender)).TextLength > 0) { ListBox_List_Groups.SetSelected(index, true); ListBox_List_Groups_SelectedIndexChanged(sender, e); } }