Solved

Converting problem in a methode.

Posted on 2012-03-24
2
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…

756 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