15,877,051 members
See more:
for stock management

How to Convert Tonnes To Kilograms
How to Convert dozen To pic
How to Convert kilograms To grams
in windows application c#

What I have tried:

How to Convert unit in windows application c#
Posted
Updated 3-Aug-17 19:56pm
Nelek 4-Aug-17 1:52am
1 Tonne = 1000 Kg
1 Kg = 1000 Gr
1 dozen = 12 pieces

Hope it helps :)

## Solution 1

For each of these units, write a function that takes an argument (the original value) and returns the converted value:
C#
```float TonnesToKilograms(float tonnes)
{
}
// ... and so on```

And, whenever you need to do a conversion in your application, just call one of these functions like this:
C#
`int kg = TonnesToKilograms(1.5); // but with an actual value passed in rather than 1.5`

v2
CPallini 4-Aug-17 3:30am
5.

## Solution 2

Set up an input control - a NumericUpDown is a good choice - and use that to get the user value to convert.
Then,
To Convert Tonnes To Kilograms : multiply by 1000
To Convert dozen To pic : work out what a "pic" is, find out the conversion rate, and multiply by that
To Convert kilograms To grams : multiply by 1000

Then use a control or a MessageBox to display the converted value

But this your homework, so I'll give you no code!

Nelek 4-Aug-17 2:07am
I suppose pic = pieces?
OriginalGriff 4-Aug-17 2:13am
I'm guessing so, but ... who knows?
Nelek 4-Aug-17 2:19am
Yeah... with such a questioner skills, one never knows
jyoti jodha 4-Aug-17 2:28am
how to write Query for this......???
OriginalGriff 4-Aug-17 3:30am
You are going to have to elaborate on that: we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
And the concept of "Query" doesn't really exist in C#, that's more a database thing which doesn't seem very applicable in this project.