Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Word._Application oWord;
            Word._Document    oDoc;
            oWord         = new Word.Application();
            oWord.Visible = true;
            oDoc          = oWord.Documents.Open(Environment.CurrentDirectory + "\\blank-spravka.doc");
            bread breakinBad = new bread(weight, count);

            oDoc.Bookmarks["Вес"].Range.Text        = Convert.ToString(breakinBad.weight);
            oDoc.Bookmarks["Количество"].Range.Text = Convert.ToString(breakinBad.count);
            oDoc.Bookmarks["Продукты"].Range.Text   = breakinBad.CountingProducts();
            oDoc.SaveAs2(FileName: Environment.CurrentDirectory + "\\Владимир Бланк");
            if (closeCheckBox == true)
            {
                oDoc.Close();
                oWord.Quit();
            }
        }
Esempio n. 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" || textBox2.Text != "")
     {
         try
         {
             weight = double.Parse(textBox1.Text);
             count  = double.Parse(textBox2.Text);
         }
         catch (FormatException)
         {
             MessageBox.Show("Отсутствую или ошибочные данные!");
             return;
         }
         bread breakinBad = new bread(weight, count);
         textBox3.Text     = breakinBad.CountingProducts();
         button2.Visible   = true;
         checkBox1.Visible = true;
     }
 }