Solved

Converting problem in a methode.

Posted on 2012-03-24
2
230 Views
Last Modified: 2012-03-25
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
0
Comment
Question by:peterkiers
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 37760848
Change:

    spdMinVal.Value = eValue;

To:

    spdMinVal.Value = (decimal)eValue;
0
 
LVL 1

Author Comment

by:peterkiers
ID: 37762296
Thanks. P.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question