private void печатьКвитанцииToolStripMenuItem_Click(object sender, EventArgs e) { EditRepairForm editForm = new EditRepairForm(Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value.ToString())); editForm.loadEditRepairForm(); //editForm.Visible = false; order = editForm.Order(); if (printDialog1.ShowDialog() == DialogResult.OK) { try { printDocument1.PrintPage += new PrintPageEventHandler(PRD); printDocument1.DocumentName = "Order"; //Названия документа printDocument1.PrinterSettings = printDialog1.PrinterSettings; //Передаем параметры printDocument1.Print(); //Начинаем процесс печати } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public void LoadClientsToForm(AddRepairForm formAddRepair = null, EditRepairForm formEditRepair = null, AddClientForm formAddClient = null) { // form = formAddRepair; /* if (formAddRepair != null) * { * form = new AddRepairForm(); * form = formAddRepair; * }*/ /* else if(formEditRepair != null) form = formEditRepair; * else if (formAddClient != null) form = formAddClient;*/ /* form = new AddRepairForm(); * * (AddRepairForm)form.comboBox_nameClient.DataSource = sql.getClients();*/ Convert.ChangeType(form, typeof(AddRepairForm)); // form.comboBox_nameClient.DataSource = sql.getClients(); formAddRepair.comboBox_nameClient.DataSource = sql.getClients(); formAddRepair.comboBox_nameClient.DisplayMember = "nameClient"; formAddRepair.comboBox_nameClient.ValueMember = "nameClient"; if (client != null) { formAddRepair.comboBox_nameClient.Text = client.NameClient; formAddRepair.textBox_Contact.Text = client.Contact; formAddRepair.textBox_Phone.Text = client.Phone; formAddRepair.textBox_Address.Text = client.Address; formAddRepair.textBox_Email.Text = client.Email; } }