jeudi 31 octobre 2019

Comparing ComboBox with an If [duplicate]

I'm trying to compare two ComboBox with a If Statement, and then get the result in a TextBox, tried several thing but can't get it

Here is the code i tried :

private void conver()
    {
        if((comboBox1.SelectedText == "Krw - Wons") && (comboBox2.SelectedText == "Euro"))
        {
            txtBox2.Text = (float.Parse(txtBox1.Text) * 0,00077).ToString();
        }
    }

Also tried that one :

 private void conver()
    {
        if((comboBox1.SelectedItem.ToString() == "Krw - Wons") && (comboBox2.SelectedItem.ToString() == "Euro"))
        {
            txtBox2.Text = (float.Parse(txtBox1.Text) * 0,00077).ToString();
        }
    }

I got 2 differents TextBox, the first one to get the amount to convert in another currency and the second TextBox to get the conversion.I don't have any error but can't get the conversion shown in the Second TextBox.

Thank you for your time.

Aucun commentaire:

Enregistrer un commentaire