Advertisement
AleksandarH

Qncho - 1 Zad.

Dec 15th, 2022
785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.51 KB | None | 0 0
  1. // FORM 1
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using static System.Windows.Forms.VisualStyles.VisualStyleElement;
  12.  
  13. namespace test2
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         public Form1()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.  
  22.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  23.         {
  24.  
  25.         }
  26.  
  27.         private void button1_Click(object sender, EventArgs e)
  28.         {
  29.  
  30.             textBox1.Text = ("New User");
  31.  
  32.         }
  33. private void textBox2_TextChanged(object sender, EventArgs e)
  34.         {
  35.  
  36.         }
  37.  
  38.         private void button2_Click(object sender, EventArgs e)
  39.         {
  40.             listBox1.Items.Add(textBox1.Text);
  41.             listBox1.Items.Add(textBox2.Text);
  42.             listBox1.Items.Add(textBox3.Text);
  43.             listBox1.Items.Add(comboBox1.Text);
  44.             listBox1.Items.Add(comboBox2.Text);
  45.  
  46.         }
  47.  
  48.         private void button3_Click(object sender, EventArgs e)
  49.         {
  50.             listBox1.Items.Clear();
  51.         }
  52.  
  53.         private void button4_Click(object sender, EventArgs e)
  54.         {
  55.            
  56.             double litre;
  57.             int n;
  58.             double ostupka;
  59.             double sum;
  60.             litre = Convert.ToDouble(textBox2.Text);
  61.             n = Convert.ToInt32(textBox3.Text);
  62.             ostupka = Convert.ToDouble(comboBox2.Text);
  63.             sum= (litre*n- ((litre * n )* (ostupka / 100)))*1.2;
  64.             textBox4.Text = sum.ToString();
  65.             Form2 f = new Form2(textBox1.Text, textBox2.Text,textBox3.Text, comboBox1.Text, comboBox2.Text);
  66.             f.Show();
  67.         }
  68.     }
  69. }
  70.  
  71. // FORM 2
  72. using System;
  73. using System.Collections.Generic;
  74. using System.ComponentModel;
  75. using System.Data;
  76. using System.Drawing;
  77. using System.IO;
  78. using System.Linq;
  79. using System.Text;
  80. using System.Threading.Tasks;
  81. using System.Windows.Forms;
  82.  
  83. namespace test2
  84. {
  85.     public partial class Form2 : Form
  86.     {
  87.         String a;
  88.        
  89.         public Form2(string b,string c,string d,string f,string a)
  90.         {
  91.             InitializeComponent();
  92.             this.a = a+b+c+d+f;
  93.         }
  94.  
  95.         private void button1_Click(object sender, EventArgs e)
  96.         {
  97.             StreamWriter s=new StreamWriter(@"File.txt");
  98.             s.Write(a);
  99.                 s.Close();
  100.         }
  101.     }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement