Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
GeneralRe: NDoc and C# 2.0 templates Pin
Pete O'Hanlon7-Feb-08 4:05
mvePete O'Hanlon7-Feb-08 4:05 
AnswerRe: NDoc and C# 2.0 templates Pin
Chesnokov Yuriy7-Feb-08 18:57
professionalChesnokov Yuriy7-Feb-08 18:57 
Generalsetting DPI in Printing Pin
Xmen Real 6-Feb-08 20:42
professional Xmen Real 6-Feb-08 20:42 
GeneralRe: setting DPI in Printing Pin
Christian Graus6-Feb-08 21:32
protectorChristian Graus6-Feb-08 21:32 
GeneralRe: setting DPI in Printing Pin
Xmen Real 6-Feb-08 23:51
professional Xmen Real 6-Feb-08 23:51 
QuestionSet the count of number after the decimal point in a column with expression Pin
Noemi Katinka6-Feb-08 20:04
Noemi Katinka6-Feb-08 20:04 
GeneralRe: Set the count of number after the decimal point in a column with expression Pin
That's Aragon6-Feb-08 20:18
That's Aragon6-Feb-08 20:18 
GeneralRe: Set the count of number after the decimal point in a column with expression [modified] Pin
DaveyM696-Feb-08 22:22
professionalDaveyM696-Feb-08 22:22 
It depends on the rounding you require.

Math.Round does a strange thing, eg:
// using ToString method because the value is being displayed
Math.Round(3.565m, 2).ToString(); // rounds down to 3.56
Math.Round(3.575m, 2).ToString(); // rounds up to 3.58

I always use
decimal x = 3.565m;
x.ToString("N2");

as the results are more consistant, trailing digit of 0-4 rounds down and 5-9 rounds up.

For no rounding as in
Noemi Katinka wrote:
9,988 but i want that only 9,98

you need a little function like
public string TrimDecimal(decimal value, int precision)
        {
            precision++;
            string returnString = value.ToString();
            int decimalPointPosition = returnString.IndexOf(".");
            if (decimalPointPosition > -1)
            {
                if (returnString.Length > (decimalPointPosition + precision))
                {
                    return returnString.Substring(0, decimalPointPosition + precision);
                }
            }
            return returnString;
        }


modified on Thursday, February 07, 2008 4:36:38 AM

GeneralRe: Set the count of number after the decimal point in a column with expression Pin
Herman<T>.Instance7-Feb-08 1:37
Herman<T>.Instance7-Feb-08 1:37 
GeneralRe: Set the count of number after the decimal point in a column with expression Pin
Noemi Katinka7-Feb-08 4:36
Noemi Katinka7-Feb-08 4:36 
QuestionReading output from the barcode reader Pin
Haj6-Feb-08 20:03
Haj6-Feb-08 20:03 
GeneralRe: Reading output from the barcode reader Pin
Joachim Kerschbaumer6-Feb-08 22:25
Joachim Kerschbaumer6-Feb-08 22:25 
GeneralVery Important Restore DataBase Pin
Thaer Hamael6-Feb-08 20:01
Thaer Hamael6-Feb-08 20:01 
GeneralRe: Very Important Restore DataBase Pin
Abhijit Jana6-Feb-08 20:27
professionalAbhijit Jana6-Feb-08 20:27 
GeneralRe: Very Important Restore DataBase Pin
Thaer Hamael6-Feb-08 21:34
Thaer Hamael6-Feb-08 21:34 
GeneralRe: Very Important Restore DataBase Pin
Abhijit Jana6-Feb-08 23:47
professionalAbhijit Jana6-Feb-08 23:47 
QuestionHow to close a socket which is already open Pin
sindhutiwari6-Feb-08 19:36
sindhutiwari6-Feb-08 19:36 
GeneralRe: How to close a socket which is already open Pin
N a v a n e e t h6-Feb-08 19:43
N a v a n e e t h6-Feb-08 19:43 
GeneralRe: How to close a socket which is already open Pin
sindhutiwari6-Feb-08 19:54
sindhutiwari6-Feb-08 19:54 
GeneralRe: How to close a socket which is already open Pin
N a v a n e e t h6-Feb-08 19:58
N a v a n e e t h6-Feb-08 19:58 
GeneralRe: How to close a socket which is already open Pin
AkmalSyed6-Feb-08 23:04
AkmalSyed6-Feb-08 23:04 
GeneralRe: How to close a socket which is already open Pin
sindhutiwari6-Feb-08 23:29
sindhutiwari6-Feb-08 23:29 
GeneralRe: How to close a socket which is already open Pin
Jamman6-Feb-08 23:57
Jamman6-Feb-08 23:57 
GeneralRe: How to close a socket which is already open Pin
Jamman7-Feb-08 0:16
Jamman7-Feb-08 0:16 
GeneralRe: How to close a socket which is already open Pin
sindhutiwari7-Feb-08 0:31
sindhutiwari7-Feb-08 0:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.