Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Fenster : Form
- {
- public Fenster()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (vBox.Text == "")
- {
- double s = Convert.ToDouble(sBox.Text);
- double t = Convert.ToDouble(tBox.Text);
- double ergebnis = 0;
- ergebnis = s / t;
- vBox.Text = Convert.ToString(ergebnis);
- }
- else if (sBox.Text == "")
- {
- double v = Convert.ToDouble(vBox.Text);
- double t = Convert.ToDouble(tBox.Text);
- double ergebnis = 0;
- ergebnis = v * t;
- sBox.Text = Convert.ToString(ergebnis);
- }
- else if (tBox.Text == "")
- {
- double v = Convert.ToDouble(vBox.Text);
- double s = Convert.ToDouble(sBox.Text);
- double ergebnis = 0;
- ergebnis = s / v;
- tBox.Text = Convert.ToString(ergebnis);
- }
- else
- {
- MessageBox.Show("Geben sie mindestens 2 Werte ein", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
- }
- }
- private void vBox_Enter(object sender, EventArgs e)
- {
- if (vBox.Text != "" && sBox.Text != "" && tBox.Text != "")
- {
- vBox.Text = "";
- sBox.Text = "";
- tBox.Text = "";
- }
- }
- private void sBox_Enter(object sender, EventArgs e)
- {
- if (vBox.Text != "" && sBox.Text != "" && tBox.Text != "")
- {
- vBox.Text = "";
- sBox.Text = "";
- tBox.Text = "";
- }
- }
- private void tBox_Enter(object sender, EventArgs e)
- {
- if (vBox.Text != "" && sBox.Text != "" && tBox.Text != "")
- {
- vBox.Text = "";
- sBox.Text = "";
- tBox.Text = "";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement