private void SearchButton_Click(object sender, EventArgs e) { try { double Low = Convert.ToDouble(FirstPriceTextBox.Text); double High = Convert.ToDouble(SecondPriceTextBox.Text); if (Low > High) { SearchDataGridView.DataSource = _mobileManager.SearchByPrice(High, Low); } else { SearchDataGridView.DataSource = _mobileManager.SearchByPrice(Low, High); } for (int i = 0; i < SearchDataGridView.Rows.Count - 1; i++) { SearchDataGridView.Rows[i].Cells[1].Value = (i + 1).ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }