You are on page 1of 2

FormBorderStyle = FormBorderStyle.Fixed3D; foreach (Control c in Controls) if (c is TextBox) (c as TextBox).Clear(); cb_gen.SelectedIndex = -1; newCol.CellTemplate = cell; newCol.Name = "Stare Cont"; dgwConturi.Columns.

Add(newCol); /* { int x = e.X; int y = e.Y + Cursor.Current.Size.Height - Cursor.Current.HotSpot.Y; } */ private void dataGridView_CellMouseDown(object sender, DataGridViewCellMouseEve ntArgs e) { if (e.RowIndex != -1 && e.ColumnIndex != -1) { if (e.Button == MouseButtons.Right) { // DataGridViewCell clic edCell = (sender as DataGridView).Ro ws[e.RowIndex].Cells[e.ColumnIndex]; // Here you can do whatever you want with the cell // this.dataGridView.CurrentCell = clic edCell; // Select th e clic ed cell, for instance // Get mouse position relative to the vehicles grid var relativeMousePosition = dataGridView.PointToClient(Curso r.Position); // Show the context menu this.contextMenuStrip1.Show(dataGridView, relativeMousePosit ion); index = e.RowIndex; } } private void dgwPersoane_MouseMove(object sender, MouseEventArgs e)

private void button1_Clic (object sender, EventArgs e) { try { // Persoane person = db.Persons.Find(1); // CurentAccount cont = db.CurentAccounts.Find(2); // Tranzactii tran = db.Tranzactii.Find(6); // cont.impuerrnicitFK = null; // db.CurentAccounts.Remove(cont); // db.Persons.Remove(person); // db.Tranzactii.Remove(tran);

var person = db.Persons.Find(3); db.Persons.Remove(person); db.SaveChanges(); MessageBox.Show("salvare"); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } /* { using (Context _Context = new Context()) { _Context.Entry(order).State = EntityState.Modified; _Context.SaveChanges(); } } public void AddOrder(Order order) { using (Context _Context = new Context()) { _Context.Orders.Add(order); _Context.SaveChanges(); } } * */ public void UpdateOrder(Order order)