Currency Convertor using Web service

·         Create C# standalone application
·         Add Service reference (http://www.webservicex.net/Currencyconvertor.asmx).
·         Create interface



·         Page load event

public Form1()
        {
            InitializeComponent();
            comboBox1.DataSource = Enum.GetValues(typeof(ServiceReference1.Currency));
            comboBox2.DataSource = Enum.GetValues(typeof(ServiceReference1.Currency));
        }


·         Button click event.

private void button1_Click(object sender, EventArgs e)
        {
            string type = comboBox1.SelectedText.ToString();
            string type2 = comboBox2.SelectedText.ToString();
            double amount = Convert.ToDouble(textBox1.Text.ToString());

            ServiceReference1.Currency From = (ServiceReference1.Currency)Enum.Parse(typeof(ServiceReference1.Currency), comboBox1.SelectedValue.ToString(), true);
            ServiceReference1.Currency To = (ServiceReference1.Currency)Enum.Parse(typeof(ServiceReference1.Currency), comboBox2.SelectedValue.ToString(), true);

            double rate = c.ConversionRate(From, To);
            double value = amount * rate;
            lblcurrency.Text = value.ToString();
           
        }

Run the project.

Comments

Popular posts from this blog

Encrypt and Decrypt text using alphabet shifting method

Gridview to Datatable and Viewstate

You think Creating Circuler Graph is a difficult task ...........!!!