Advertisement
Kirsiina

tilausNappi

Oct 22nd, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1.         private void tilaaNappi_Click(object sender, EventArgs e)
  2.         {
  3.             try
  4.             {
  5.  
  6.                 string maara;
  7.                 int value = (int)numericUpDown1.Value;
  8.                 maara = "" + (e95 + value);
  9.  
  10.                 DialogResult result = MessageBox.Show("Oletko varma?", "Tilataan lisää", MessageBoxButtons.YesNo);
  11.  
  12.                 if (result == DialogResult.Yes)
  13.                 {
  14.                     e95 = int.Parse(maara);
  15.                     using (StreamWriter sw = new StreamWriter(tiedostoPolku))
  16.                     {
  17.                         sw.WriteLine(e95);
  18.                         sw.WriteLine(e98);
  19.                         sw.WriteLine(diesel);
  20.  
  21.                         this.Close();
  22.                     }
  23.                 }
  24.  
  25.             }
  26.             catch
  27.             {
  28.                 MessageBox.Show("Jotain meni pieleen");
  29.             }
  30.  
  31.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement