Solved

Error in a methode

Posted on 2012-03-20
3
445 Views
Last Modified: 2012-03-20
Hi,

I have this:

        private void edtVal1_CustomDisplayText_1(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
        {
            if (Properties.Settings.Default.IsMGDL)
            {
                edtVal1.Properties.Mask.EditMask = "d";
                edtVal1.Properties.DisplayFormat.FormatType = FormatType.Numeric;
                edtVal1.Properties.DisplayFormat.FormatString = "d";
                edtVal1.Properties.EditFormat.FormatType = FormatType.Numeric;
                edtVal1.Properties.EditFormat.FormatString = "d";
                edtVal1.Properties.MinValue = 70;
                edtVal1.Properties.MaxValue = 140;
                edtUnit1.EditValue = "mg/dl";
            }
            else
            {
                edtVal1.Properties.Mask.EditMask = "n1";
                edtVal1.Properties.DisplayFormat.FormatType = FormatType.Numeric;
                edtVal1.Properties.DisplayFormat.FormatString = "n1";
                edtVal1.Properties.EditFormat.FormatType = FormatType.Numeric;
                edtVal1.Properties.EditFormat.FormatString = "n1";
                 edtVal1.Properties.MinValue = 1.0; <==================
                   edtVal1.Properties.MaxValue = 35.0; <=====================
                edtUnit1.EditValue = "mmol/l";
            }
        }

Open in new window


I get an error at the 2 lines that I have marked with an arrow.

"Literal of type double cannot be implicitly converted to type 'decimal'; use an 'M' suffix to create a literal of this type"

What can I do about this to solve this?

Peter
0
Comment
Question by:peterkiers
3 Comments
 
LVL 18

Assisted Solution

by:Cluskitt
Cluskitt earned 100 total points
ID: 37741332
Use =1 and =35. Implicit conversion of a double to integer cannot be made as it would imply losing precision. You can also cast it with (int) 35.0.
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 400 total points
ID: 37741334
edtVal1.Properties.MinValue = 1.0M;
edtVal1.Properties.MaxValue = 35.0M;

or

edtVal1.Properties.MinValue = (decimal)1.0;
edtVal1.Properties.MaxValue =  (decimal)35.0M;
0
 
LVL 1

Author Comment

by:peterkiers
ID: 37741352
Thanks for the response.
It helped me alot.

Greetings,


Peter Kiers
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

816 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now