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

C#

 
GeneralRe: Small question on Finalizers Pin
Foothill2-Jun-16 11:22
professionalFoothill2-Jun-16 11:22 
GeneralRe: Small question on Finalizers Pin
Dave Kreskowiak2-Jun-16 11:58
mveDave Kreskowiak2-Jun-16 11:58 
GeneralRe: Small question on Finalizers Pin
Foothill3-Jun-16 5:10
professionalFoothill3-Jun-16 5:10 
AnswerRe: Small question on Finalizers Pin
Richard Deeming2-Jun-16 9:34
mveRichard Deeming2-Jun-16 9:34 
GeneralRe: Small question on Finalizers Pin
Foothill2-Jun-16 11:02
professionalFoothill2-Jun-16 11:02 
QuestionHow to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
somagunasekaran2-Jun-16 1:35
somagunasekaran2-Jun-16 1:35 
AnswerRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Richard Deeming2-Jun-16 2:11
mveRichard Deeming2-Jun-16 2:11 
AnswerRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
OriginalGriff2-Jun-16 4:08
mveOriginalGriff2-Jun-16 4:08 
There's no real "logic part" in the operation: it's all about identifying what the conversion factor is.
I'm just guessing that you're a beginner and this is homework - so I won't explain how I'd do it (it probably involves some bits you haven't got to yet) and suggest that you pick a "base unit" and provide each possible "convertable unit" with a value which converts to that base unit. For example, if you select the kilogram as your base unit, then the conversion factor for 1lb would be 2.20462, and the conversion factor for 1oz would be 35.274
So to convert from "unit a" to "unit b" you multiply the number of items by the "unit b" conversion factor, divide that by the "unit a" convertion factor, and round it to perhaps 2 decimal places.
If the number of lb is 6.0, then you would convert to oz by:
6.0 * 35.274 / 2.20462 = 96.0002177246

Rounded, that's 96.00 oz.
So all you need to do is write a method which takes the selected unit text, and returns the conversion factor. Then call that twice, and you're pretty much there!

Try it: it's simpler than it sounds!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Richard MacCutchan2-Jun-16 4:35
mveRichard MacCutchan2-Jun-16 4:35 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
OriginalGriff2-Jun-16 4:57
mveOriginalGriff2-Jun-16 4:57 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Pete O'Hanlon2-Jun-16 5:37
mvePete O'Hanlon2-Jun-16 5:37 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
OriginalGriff2-Jun-16 6:05
mveOriginalGriff2-Jun-16 6:05 
GeneralRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Mycroft Holmes2-Jun-16 13:03
professionalMycroft Holmes2-Jun-16 13:03 
AnswerRe: How to convert pounds(Lb) to ounce(Oz) and Ounce(Oz) to Pounds(Lb) in C#.Net code Pin
Gerry Schmitz2-Jun-16 4:58
mveGerry Schmitz2-Jun-16 4:58 
Questionplz introduce appropriate component Pin
Member 125609791-Jun-16 22:15
Member 125609791-Jun-16 22:15 
AnswerRe: plz introduce appropriate component Pin
OriginalGriff1-Jun-16 23:07
mveOriginalGriff1-Jun-16 23:07 
AnswerRe: plz introduce appropriate component Pin
Gerry Schmitz2-Jun-16 5:20
mveGerry Schmitz2-Jun-16 5:20 
AnswerRe: plz introduce appropriate component Pin
Eddy Vluggen3-Jun-16 0:06
professionalEddy Vluggen3-Jun-16 0:06 
QuestionTest Methods Are Grayed out Pin
MadDashCoder1-Jun-16 19:24
MadDashCoder1-Jun-16 19:24 
AnswerRe: Test Methods Are Grayed out Pin
Gerry Schmitz2-Jun-16 5:13
mveGerry Schmitz2-Jun-16 5:13 
QuestionShow message box on top from windows tray application. Pin
raydebojyoti1-Jun-16 0:25
raydebojyoti1-Jun-16 0:25 
AnswerRe: Show message box on top from windows tray application. Pin
OriginalGriff1-Jun-16 1:08
mveOriginalGriff1-Jun-16 1:08 
GeneralRe: Show message box on top from windows tray application. Pin
raydebojyoti1-Jun-16 1:59
raydebojyoti1-Jun-16 1:59 
QuestionHow to find method is implemented Pin
Amit Patel198531-May-16 23:56
Amit Patel198531-May-16 23:56 
AnswerRe: How to find method is implemented Pin
Garth J Lancaster1-Jun-16 0:01
professionalGarth J Lancaster1-Jun-16 0:01 

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.