Click here to Skip to main content
15,892,072 members
Home / Discussions / C#
   

C#

 
GeneralRe: string conversion to double Pin
DaveyM6914-Jan-10 13:12
professionalDaveyM6914-Jan-10 13:12 
GeneralRe: string conversion to double Pin
Eddy Vluggen14-Jan-10 13:13
professionalEddy Vluggen14-Jan-10 13:13 
GeneralRe: string conversion to double Pin
Aljaz11114-Jan-10 13:22
Aljaz11114-Jan-10 13:22 
GeneralRe: string conversion to double Pin
DaveyM6914-Jan-10 13:30
professionalDaveyM6914-Jan-10 13:30 
GeneralRe: string conversion to double Pin
Eddy Vluggen14-Jan-10 13:31
professionalEddy Vluggen14-Jan-10 13:31 
GeneralRe: string conversion to double Pin
Aljaz11114-Jan-10 13:41
Aljaz11114-Jan-10 13:41 
GeneralRe: string conversion to double Pin
Eddy Vluggen14-Jan-10 21:16
professionalEddy Vluggen14-Jan-10 21:16 
AnswerRe: string conversion to double Pin
DaveyM6914-Jan-10 13:21
professionalDaveyM6914-Jan-10 13:21 
I'm not quite sure how you're approching this but it's quite simple
public static double StringToRoundedDouble(string s, int decimals)
{
    double result;
    if (double.TryParse(s, out result))
        result = Math.Round(result, decimals, MidpointRounding.AwayFromZero);
    return result;
}
Useage
double d =(StringToRoundedDouble("0.5555", 1);


Dave

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

QuestionTCPIP server single connection Pin
ikurtz14-Jan-10 11:48
ikurtz14-Jan-10 11:48 
AnswerRe: TCPIP server single connection Pin
Jimmanuel14-Jan-10 13:01
Jimmanuel14-Jan-10 13:01 
GeneralRe: TCPIP server single connection Pin
ikurtz14-Jan-10 13:40
ikurtz14-Jan-10 13:40 
GeneralRe: TCPIP server single connection Pin
Luc Pattyn14-Jan-10 13:59
sitebuilderLuc Pattyn14-Jan-10 13:59 
QuestionMessage Removed Pin
14-Jan-10 10:13
KSR8114-Jan-10 10:13 
AnswerRe: Need help for these questions Pin
EliottA14-Jan-10 10:37
EliottA14-Jan-10 10:37 
GeneralRe: Need help for these questions Pin
OriginalGriff14-Jan-10 10:41
mveOriginalGriff14-Jan-10 10:41 
GeneralOR Pin
Ennis Ray Lynch, Jr.14-Jan-10 11:25
Ennis Ray Lynch, Jr.14-Jan-10 11:25 
AnswerRe: Need help for these questions Pin
Pete O'Hanlon14-Jan-10 10:51
mvePete O'Hanlon14-Jan-10 10:51 
QuestionDynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 10:00
professionalGuyThiebaut14-Jan-10 10:00 
AnswerRe: Dynamically referencing a control - how do I do this (better)? Pin
OriginalGriff14-Jan-10 10:32
mveOriginalGriff14-Jan-10 10:32 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 10:42
professionalGuyThiebaut14-Jan-10 10:42 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
Eddy Vluggen14-Jan-10 11:58
professionalEddy Vluggen14-Jan-10 11:58 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 19:07
professionalGuyThiebaut14-Jan-10 19:07 
AnswerRe: Dynamically referencing a control - how do I do this (better)? Pin
Luc Pattyn14-Jan-10 13:12
sitebuilderLuc Pattyn14-Jan-10 13:12 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
GuyThiebaut14-Jan-10 19:05
professionalGuyThiebaut14-Jan-10 19:05 
GeneralRe: Dynamically referencing a control - how do I do this (better)? Pin
Luc Pattyn15-Jan-10 0:41
sitebuilderLuc Pattyn15-Jan-10 0:41 

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.