private void searchButton_Click(object sender, EventArgs e) { if (IDtextBox.Text == "") { MessageBox.Show("Please, fill the field!"); } else { if (!int.TryParse(IDtextBox.Text, out int result)) { MessageBox.Show("Value entered is too large!"); } else { if (InvoiceLogic.IsInvoiceExists(result) == -1) { MessageBox.Show("Invoice does not exist!"); } else { textLabel.Text = InvoiceLogic.GetByID(int.Parse(IDtextBox.Text)).ToString(); } } } }