//метод поиска и вывода по имени //method of searching and inference by name private void search_name() { //считываем количество элементов коллекции "List" в объекте типа Photo_List //we read the number of elements of the "List" collection in the object of type Photo_List int count = NewLister.COUNT_int; //просматриваем все элементы коллекции "List" в объекте типа Photo_List //we scan all the elements of the "List" collection in an object of the type Photo_List for (int i = 0; i < count; i++) { //если в строке имени фото есть подстрока из входных данных от пользователя, то выводим имя и дату этого фото //If the line name of the photo has a substring from the input data from the user, then we display the name and date of this photo if (NewLister.NAME_OF_PHOTO(i).Contains(textBox1.Text)) { dataGridView1.Rows.Add(NewLister.NAME_OF_PHOTO(i), NewLister.DATE_OF_PHOTO(i).ToString()); } } }
//событие для окончание редакции ячейки //event to end the revision of the cell private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { //получаем индекс выбранного ряда //get the index of the selected row int ind = dataGridView1.CurrentRow.Index; //вытаскиваем имя файла выбранной строки //extract the file name of the selected line string name = (string)dataGridView1[0, ind].Value; //метод для смены инкапсулированного поля имени //method for changing the encapsulated name field lister.NAME_OF_PHOTO(ind, name); } //исключения для случая попытки редактирования не существующей ячейки //Exceptions for an attempt to edit an existing cell catch (ArgumentOutOfRangeException) { //выводим данное сообщение //output this message MessageBox.Show("Пустуя строку недопустимо редактировать!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }