Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class Form2 : Form
- {
- public int InventoryId = 0;
- private DataRow CurrentRow;
- public Form2()
- {
- InitializeComponent();
- }
- private void SaveItem_Click()
- {
- this.Validate();
- this.inventoryBindingSource.EndEdit();
- this.tableAdapterManager.UpdateAll(this.garysInventoryDataSet);
- }
- private void Form2_Load(object sender, EventArgs e)
- {
- this.inventoryTableAdapter.Fill(this.garysInventoryDataSet.Inventory);
- CurrentRow = (from x in garysInventoryDataSet.Inventory
- where x.InventoryId == InventoryId
- select x).FirstOrDefault();
- if (CurrentRow == null)
- {
- MessageBox.Show("Inventory Item Not Found.");
- }
- yearToDateQuantityTextBox.Text = CurrentRow["YearToDateQuantity"].ToString();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- CurrentRow["YearToDateQuantity"] = Convert.ToInt32(CurrentRow["YearToDateQuantity"]) + 1;
- yearToDateQuantityTextBox.Text = CurrentRow["YearToDateQuantity"].ToString();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- CurrentRow["YearToDateQuantity"] = Convert.ToInt32(CurrentRow["YearToDateQuantity"]) - 1;
- yearToDateQuantityTextBox.Text = CurrentRow["YearToDateQuantity"].ToString();
- }
- private void Form2_FormClosing(object sender, FormClosingEventArgs e)
- {
- SaveItem_Click();
- }
- }
Add Comment
Please, Sign In to add comment