Hey guys!
I'm studying for my college exam and I just had some fun coding a little currency converter.
I'm not sure if many people would use it, but hey what the heck.
Mods: sorry if its in the wrong forum..
It will calculate from euro to dollar and the other way around.
For current currencys:
http://www.google.nl/webhp?hl=nl#hl=...w=1366&bih=651
Use that currency for the calculation (1 Euro = 1.2273 U.S. dollars) so use 1.2273 in the upper field for currency.
Screenshots:
Code:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace H11Oef3
{
public partial class FormH11Oef3 : Form
{
public FormH11Oef3()
{
InitializeComponent();
}
private void buttonVerwerk_Click(object sender, EventArgs e)
{
//declaratie
double bedrag, bedragHulp;
if (!double.TryParse(textBox1.Text, out bedragHulp) == true)
{
this.Text = "Please only insert a double!";
textBox1.Clear();
textBox1.Text = "Only decimal numbers!";
}
if (textBoxEuro.Text == "" && textBoxDollar.Text == "")
{
this.Text = "Please fill in a field.";
textBoxDollar.Text = "Fill in one of these fields.";
textBoxEuro.Text = "Fill in one of these fields.";
}
else
{
if (double.TryParse(textBoxEuro.Text, out bedragHulp) == true)
{
this.Text = "From Euro to Dollar.";
bedrag = ZetOm(Convert.ToDouble(textBoxEuro.Text), 1);
textBoxDollar.Text = "-> " + bedrag;
}
else
{
if (double.TryParse(textBoxDollar.Text, out bedragHulp) == true)
{
this.Text = "From Dollar to Euro";
bedrag = ZetOm(Convert.ToDouble(textBoxDollar.Text), 2);
textBoxEuro.Text = "-> " + bedrag;
}
else
{
this.Text = "Fill in one field please.";
}
}
}
}
private void FormH11Oef3_Load(object sender, EventArgs e)
{
label1.Text = "Current currency? " + Environment.NewLine + "Example: 1,185 from € to $ ";
this.Text = "Currency converter.";
buttonVerwerk.Text = "Calculate!";
textBox1.Text = "1,185";
this.Icon = Properties.Resources.favicon;
}
private double ZetOm(double bedrag, int code)
{
double resultaat = 0.00;
double omzetkoers = Convert.ToDouble(textBox1.Text); ;
if (code == 1)
{
resultaat = bedrag * omzetkoers;
}
else
{
resultaat = bedrag / omzetkoers;
}
return resultaat;
}
private void textBox1_Click(object sender, EventArgs e)
{
textBox1.Clear();
}
private void textBoxEuro_Click(object sender, EventArgs e)
{
textBoxEuro.Clear();
textBoxDollar.Clear();
}
private void textBoxDollar_Click(object sender, EventArgs e)
{
textBoxDollar.Clear();
textBoxEuro.Clear();
}
}
}
Antivirus scan:
Download link:
http://www.mediafire.com/?hnqpjm97guu63dq
If a mod needs the programme for verification or something, just PM me.