public void OpenFormToEdit(DataGrid dataGrid) { Orders ord = (Orders)dataGrid.SelectedItems[0]; OrdersAdder form = new OrdersAdder(); form.ord = ord; form.customer.SelectedIndex = form.foreignCustID.IndexOf(ord.CustomerID); if (ord.EmployeeID.HasValue) { form.employee.SelectedIndex = form.foreignEmplID.IndexOf((int)ord.EmployeeID); } form.orderDate.SelectedDate = ord.OrderDate; form.requiredDate.SelectedDate = ord.RequiredDate; form.shippedDate.SelectedDate = ord.ShippedDate; form.freight.Text = ord.Freight.ToString(); form.shippedTo.Text = ord.ShipName; form.shipCity.Text = ord.ShipCity; form.shipCountry.Text = ord.ShipCountry; form.shipAddress.Text = ord.ShipAddress; form.shipPostalCode.Text = ord.ShipPostalCode; form.ShowDialog(); }
public void OpenForm() { OrdersAdder form = new OrdersAdder(); form.ShowDialog(); }