I am creating simple window money changer via microsoft visual studio and am encountering errors(refer to the picture) I hope you can help me solve this one
I am creating simple window money changer via microsoft visual studio and am encountering errors(refer to the picture) I hope you can help me solve this one.
this is my code
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 Act3_AggaraoMikael_608
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label3_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
// Declares a variable
double amount, converted = 0, exchange = 0;
char currency;
// Sstores the value of each textbox into variable
amount = Convert.ToDouble(txtAmount.Text);
currency = Convert.ToChar(txtCurrency.Text);
// Uses Nested if
if (currency == 'D' || currency == 'd');
exchange = 44.50;
else if (currency == 'Y' || currency == 'y');
exchange = 0.58;
else if (currency == 'R' || currency == 'r') ;
exchange = 18.43;
else if (currency == 'P' || currency == 'p') ;
exchange = 115.65;
else MessageBox.Show("Sorry, not available!");
converted = amount * exchange;
txtConverted.Text = "P" + Convert.ToString(converted);
}
private void button2_Click(object sender, EventArgs e)
{
txtAmount.Clear();
txtConverted.Clear();
txtCurrency.Clear();
}
}
}
Step by step
Solved in 2 steps