Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Converting problem in a methode.

Dear Experts,

I programm in VS2010 and I use C#. I have this code but it has an error.
I have marked the codeline with an arrow that has the error :

        private void btnSwUnit_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.IsMGDL = !Properties.Settings.Default.IsMGDL;
            Properties.Settings.Default.Save();
            if (Properties.Settings.Default.IsMGDL)
            {
                btnSwUnit.Text = "Switch to mmol/l";
                lblSwUnit.Text = "Glucose Units: mg/dl";

                int eValInt = Convert.ToInt32(spdMinVal.Value) / 18;
                spdMinVal.Value = eValInt;
            }
            else
            {
                btnSwUnit.Text = "Switch to mg/dl";
                lblSwUnit.Text = "Glucose Units: mmol/l";

                double eValue = Convert.ToDouble(spdMinVal.Value) * 18; 
                spdMinVal.Value = eValue; <==========

            }
        }

Open in new window


Error:
"Cannot implicitly convert type 'double' to 'decimal'. An explicit conversion exists (are you missing a cast?)".

How can I solve this?

Greetings,

Peter Kiers
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Peter Kiers

ASKER

Thanks. P.