private void addButton_Click(object sender, EventArgs e) { try { Item item = new Item(); item.CompanyId = Convert.ToInt32(companyCombo.SelectedValue); item.CompanyName = companyCombo.Text; item.Id = Convert.ToInt32(itemCombo.SelectedValue); item.Name = itemCombo.Text; item.Quantity = Convert.ToInt32(quantityBox.Value); _stockOutManager.AddItem(item); addItemDataGrid.Show(); sellButton.Show(); damageButton.Show(); lostButton.Show(); addItemDataGrid.DataSource = _stockOutManager.GetItemTable(); model.AddAutoIncrementColumn(addItemDataGrid); _stock.ItemId = Convert.ToInt32(itemCombo.SelectedValue); _stock.Quantity = Convert.ToInt32(quantityBox.Value); _stockOutManager.AddToList(_stock); } catch (Exception exc) { MessageBox.Show(exc.Message); } }