private void buttonAdd_Click(object sender, EventArgs e) { try { AddForm add = new AddForm(); add.ShowDialog(); if (add.DialogResult == DialogResult.OK && add.Change() == 1) { StudentdataGridView.Rows.Add(add.FullName(), add.Group(), add.Gpa(), student.Stat(Convert.ToDouble(add.Gpa()))); student.StateColored(StudentdataGridView); } else if (add.DialogResult == DialogResult.OK && add.Change() == 2) { TeacherdataGridView.Rows.Add(add.FullName(), add.Major()); } RefreshCB(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } // Добавление
private void editToolStripMenuItem_Click(object sender, EventArgs e) { currentIndex = lstResults.SelectedIndices[0]; if (!frmAdd.IsDisposed) { frmAdd.Dispose(); } frmAdd = new AddForm(); frmAdd.InfoUpdated += frmAdd_InfoUpdated; frmAdd.ShowEditForm(items[currentIndex]); }
//Add to Stock private void toolStripMenuItem1_Click(object sender, EventArgs e) { if (!frmAdd.IsDisposed) { frmAdd.Dispose(); } frmAdd = new AddForm(); frmAdd.InfoAdded += frm_InfoAdded; currentIndex = lstResults.SelectedIndices[0]; frmAdd.ShowForm(items[currentIndex]); }
private void pnlAdd_Click(object sender, EventArgs e) { //InventoryItem itm = new InventoryItem(); if (!frmAdd.IsDisposed) { frmAdd.Dispose(); } frmAdd = new AddForm(); frmAdd.InfoAdded += frm_InfoAdded; frmAdd.ShowForm(); // }
private void button3_Click_1(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1) { int index = listView1.SelectedItems[0].Index; DataRow row = dt.Rows[index]; Car c = new Car(row[0].ToString(), row[1].ToString(), row[2].ToString(), Convert.ToInt32(row[3]), row[4].ToString(), Convert.ToInt32(row[5])); var f = new AddForm(c); if (f.ShowDialog() == DialogResult.OK) { var car = f.car; row[0] = car.Make; row[1] = car.Model; row[2] = car.Type; row[3] = car.Year; row[4] = car.Plate; row[5] = car.Speed; setFilter(); } } }
public Form1() { InitializeComponent(); items = new List <InventoryItem>(); orders = new List <Order>(); frmAdd = new AddForm(); frmSell = new SellForm(); frmRemove = new RemoveForm(); //frm.MdiParent = this; frmAdd.InfoAdded += frm_InfoAdded; frmAdd.InfoUpdated += frmAdd_InfoUpdated; frmSell.Sold += frmSell_Sold; frmRemove.Removed += frmRemove_Removed; DB.onEvent += DB_onEvent; items = all; orders = allOrders; ReadRecords(); }