private void dataGridViewANC_CellClick(object sender, DataGridViewCellEventArgs e) { CheckAndAddCustomerData.Enabled = true; CheckAndAddВookingData.Enabled = true; selectedNumberOfApartments = ElementsSettings.SelectNumberOfSelectedApartments(dataGridViewANC, e); if (textBox13.Text != "" && textBox14.Text != "" && ancSettlingDateTimePicker.Value < ancEvictionDateTimePicker.Value) { TimeSpan ts = ancEvictionDateTimePicker.Value - ancSettlingDateTimePicker.Value; resultPriceTextBox.Text = ((ts.Days + 1) * ElementsSettings.SelectPriceOfSelectedApartments(dataGridViewANC, e) * (Convert.ToInt32(textBox13.Text) - Convert.ToInt32(textBox14.Text)) + (ts.Days + 1) * Convert.ToInt32(textBox14.Text) * (ElementsSettings.SelectPriceOfSelectedApartments(dataGridViewANC, e) - (ElementsSettings.SelectPriceOfSelectedApartments(dataGridViewANC, e) / 100 * Convert.ToInt32(discountTextBox.Text)))).ToString(); } else { resultPriceTextBox.Text = "<некорректные данные>"; } }