Skip to content

Instantly share code, notes, and snippets.

@minons1
Created March 31, 2021 14:21
Show Gist options
  • Save minons1/e3cdb1f79c065b2efc8aa1837ab4a5c9 to your computer and use it in GitHub Desktop.
Save minons1/e3cdb1f79c065b2efc8aa1837ab4a5c9 to your computer and use it in GitHub Desktop.
Currency Converter Windows Form App .NET framework C#
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;
using Newtonsoft.Json.Linq;
namespace Currency_Converter
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
boxKanan.DropDownStyle = ComboBoxStyle.DropDownList;
boxKiri.DropDownStyle = ComboBoxStyle.DropDownList;
}
private void con_button(object sender, EventArgs e)
{
String CurrencyJSON = "{IDR_IDR: 1,IDR_USD: 6.8620757e-05,IDR_EUR: 5.8495421e-05,IDR_JPY: 0.007595,IDR_CAD: 8.6489945e-05,IDR_GBP: 4.9835482e-05,USD_IDR: 14572.85,USD_USD: 1,USD_EUR: 0.852275,USD_JPY: 110.652051,USD_CAD: 1.260325,USD_GBP: 0.726295,EUR_IDR: 17095.120506,EUR_USD: 1.173096,EUR_EUR: 1,EUR_JPY: 129.823011,EUR_CAD: 1.478512,EUR_GBP: 0.851768,JPY_IDR: 131.672467,JPY_USD: 0.009035,JPY_EUR: 0.007702,JPY_JPY: 1,JPY_CAD: 0.011388,JPY_GBP: 0.006562,CAD_IDR: 11562.642568,CAD_USD: 0.793421,CAD_EUR: 0.676348,CAD_JPY: 87.80707,CAD_CAD: 1,CAD_GBP: 0.576139,GBP_IDR: 20070.170848,GBP_USD: 1.377249,GBP_EUR: 1.174029,GBP_JPY: 152.416008,GBP_CAD: 1.735816,GBP_GBP: 1}";
var CurrencyObject = JObject.Parse(CurrencyJSON);
textKanan.Text = (Double.Parse(CurrencyObject[$"{boxKiri.Text}_{boxKanan.Text}"].ToString()) * Double.Parse(textKiri.Text)).ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment