private void BtnAddNewItem_Click(object sender, EventArgs e) { if (IsValidate()) { char[] a = txtItemName.Text.ToLower().ToCharArray(); a[0] = char.ToUpper(a[0]); ItemsModel newItem = new ItemsModel() { ItemName = new string(a) }; itemsList = PrepAndPaintDB.GetItemsList(); foreach (var item in itemsList) { if (item.ItemName == newItem.ItemName) { MessageBox.Show($" Item: {newItem.ItemName} already exist", "Exit already!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtItemName.Focus(); return; } } itemName = PrepAndPaintDB.AddItem(newItem); DialogResult = DialogResult.OK; } }