View difference between Paste ID: 0z7x7wsL and KAszwcnD
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.Drawing;
7
using System.Windows.Forms;
8
9
namespace GUI
10
{
11
    class Program
12
    {
13
        static TextBox txtFah;
14
        static TextBox txtCel;
15
        static Button toFah;
16
        static Button toCel;
17
18
        static void Main(string[] args)
19
        {
20
            txtFah = new TextBox();
21
            txtCel = new TextBox();
22
            toFah = new Button();
23
            toCel = new Button();
24
25
            Form appForm;
26
            appForm = new Form();
27
            appForm.Size = new Size(600, 250);
28
            appForm.Text = "Temperature Converter";
29
30
            Label Fah = new Label();
31
            Fah.Size = new Size(100, 50);
32
            Fah.Text = "Fahrenheit";
33
            Fah.Location = new Point(50, 50);
34
            appForm.Controls.Add(Fah);
35
36
            txtFah = new TextBox();
37
            txtFah.Size = new Size(150, 100);
38
            txtFah.Location = new Point(120, 50);
39
            appForm.Controls.Add(txtFah);
40
41
            toCel = new Button();
42
            toCel.Size = new Size(150, 25);
43
            toCel.Text = "To Celsius";
44
            toCel.Location = new Point(300, 50);
45
            appForm.Controls.Add(toCel);
46
47
            Label Cel = new Label();
48
            Cel.Size = new Size(100, 100);
49
            Cel.Text = "Celsius";
50
            Cel.Location = new Point(50, 120);
51
            appForm.Controls.Add(Cel);
52
53
            txtCel = new TextBox();
54
            txtCel.Size = new Size(150, 100);
55
            txtCel.Location = new Point(120, 110);
56
            appForm.Controls.Add(txtCel);
57
58
            toFah = new Button();
59
            toFah.Size = new Size(150, 25);
60
            toFah.Text = "To Farenheit";
61
            toFah.Location = new Point(300, 105);
62
            appForm.Controls.Add(toFah);
63
64
            Application.Run(appForm);
65
        }
66
67
        private static void toFah_Click(object sender, EventArgs e)
68
        {
69
            Double number = Convert.ToDouble(txtCel.Text); 
70
            Double farenheit = (number - 32) / 9 * 5;
71-
            String formatedNumber = String.Format("{0:f1}", number);
71+
           // String formatedNumber = String.Format("{0:f1}", number);
72
            String formatedFareheit = String.Format("{0:f1}", txtFah.Text);
73-
            Console.WriteLine(formatedNumber + " " + (char)176 + "F is = " + formatedFareheit + " " + (char)176 + "C");
73+
           // Console.WriteLine(formatedNumber + " " + (char)176 + "F is = " + formatedFareheit + " " + (char)176 + "C");
74
75
        }
76
        private static void toCel_Click(object sender, EventArgs e)
77
        {
78
            Double number = Convert.ToDouble(txtFah.Text); 
79
            Double celsius = (number / 5) * 9 + 32;
80-
            String secondNumber = String.Format("{0:f1}", number);
80+
            //String secondNumber = String.Format("{0:f1}", number);
81
            String formatedCelsius = String.Format("{0:f1}", txtCel.Text);
82-
            Console.WriteLine(secondNumber + " " + (char)176 + "C is = " + formatedCelsius + " " + (char)176 + "F");
82+
            //Console.WriteLine(secondNumber + " " + (char)176 + "C is = " + formatedCelsius + " " + (char)176 + "F");
83
        }
84
    }
85
}