Click here to Skip to main content
15,881,687 members
Home / Discussions / C#
   

C#

 
QuestionHow do I cast a double to an int? Pin
Justiin126511-Apr-11 7:18
Justiin126511-Apr-11 7:18 
AnswerRe: How do I cast a double to an int? Pin
Eddy Vluggen11-Apr-11 7:25
professionalEddy Vluggen11-Apr-11 7:25 
GeneralRe: How do I cast a double to an int? Pin
Justiin126511-Apr-11 7:44
Justiin126511-Apr-11 7:44 
AnswerRe: How do I cast a double to an int? Pin
Eddy Vluggen11-Apr-11 8:09
professionalEddy Vluggen11-Apr-11 8:09 
GeneralRe: How do I cast a double to an int? Pin
David198711-Apr-11 7:35
David198711-Apr-11 7:35 
GeneralRe: How do I cast a double to an int? Pin
Justiin126511-Apr-11 7:45
Justiin126511-Apr-11 7:45 
GeneralRe: How do I cast a double to an int? Pin
AspDotNetDev11-Apr-11 8:06
protectorAspDotNetDev11-Apr-11 8:06 
AnswerRe: How do I cast a double to an int? Pin
Alan N11-Apr-11 7:47
Alan N11-Apr-11 7:47 
On which line does the compiler show the error? My guess is it goes wrong at
return Refurb_Rate;
as the method return type is Int32.

If you were to change the declaration of Refurb_Rate from Double to Int32 then the problem would go away.

I'm not sure what you are trying to do in the line
Refurb_Rate = Convert.ToInt32( totalRefurb / totalUnits * 100); 

It doesn't make much sense as the result of the expression on the RHS is already Int32 making the explicit conversion redundant.

Alan.
AnswerRe: How do I cast a double to an int? Pin
Luc Pattyn11-Apr-11 8:09
sitebuilderLuc Pattyn11-Apr-11 8:09 
GeneralRe: How do I cast a double to an int? Pin
Justiin126511-Apr-11 8:14
Justiin126511-Apr-11 8:14 
GeneralRe: How do I cast a double to an int? Pin
AspDotNetDev11-Apr-11 8:29
protectorAspDotNetDev11-Apr-11 8:29 
QuestionPRE Tagged Pin
AspDotNetDev11-Apr-11 8:11
protectorAspDotNetDev11-Apr-11 8:11 
AnswerRe: PRE Tagged Pin
Luc Pattyn11-Apr-11 8:16
sitebuilderLuc Pattyn11-Apr-11 8:16 
AnswerRe: How do I cast a double to an int? [modified] Pin
Luc Pattyn11-Apr-11 8:14
sitebuilderLuc Pattyn11-Apr-11 8:14 
GeneralRe: How do I cast a double to an int? Pin
AspDotNetDev11-Apr-11 8:21
protectorAspDotNetDev11-Apr-11 8:21 
GeneralRe: How do I cast a double to an int? Pin
Luc Pattyn11-Apr-11 8:27
sitebuilderLuc Pattyn11-Apr-11 8:27 
GeneralRe: How do I cast a double to an int? Pin
David198711-Apr-11 8:45
David198711-Apr-11 8:45 
AnswerRe: How do I cast a double to an int? Pin
Luc Pattyn11-Apr-11 8:55
sitebuilderLuc Pattyn11-Apr-11 8:55 
GeneralRe: How do I cast a double to an int? Pin
David198711-Apr-11 9:04
David198711-Apr-11 9:04 
GeneralRe: How do I cast a double to an int? Pin
Luc Pattyn11-Apr-11 9:25
sitebuilderLuc Pattyn11-Apr-11 9:25 
AnswerRe: How do I cast a double to an int? Pin
charles henington12-Apr-11 1:34
charles henington12-Apr-11 1:34 
Questiondropdown to enum Pin
fififlowertot11-Apr-11 5:04
fififlowertot11-Apr-11 5:04 
AnswerRe: dropdown to enum PinPopular
OriginalGriff11-Apr-11 5:11
mveOriginalGriff11-Apr-11 5:11 
GeneralRe: dropdown to enum Pin
fififlowertot11-Apr-11 5:35
fififlowertot11-Apr-11 5:35 
GeneralRe: dropdown to enum Pin
musefan11-Apr-11 5:40
musefan11-Apr-11 5:40 

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.