473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Inch / Metric value

Hi NG,

in a dataset.datatable I have rows, containing metric data as doubles.
I need to display/edit these values in textboxes depending on the culture
(Metric/Inch). Is there something like a built in conversion functionality
for that in the framework / visualstudio or do I have to do these
conversions manually?

Thanks for help and hints
Rainer
Jun 12 '06 #1
8 2314
As far as I know you would have to convert them manually.

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Rainer Queck" <Ra****@noemail.noemail> wrote in message
news:eH*************@TK2MSFTNGP05.phx.gbl...
Hi NG,

in a dataset.datatable I have rows, containing metric data as doubles.
I need to display/edit these values in textboxes depending on the culture
(Metric/Inch). Is there something like a built in conversion functionality
for that in the framework / visualstudio or do I have to do these
conversions manually?

Thanks for help and hints
Rainer

Jun 12 '06 #2
"Rainer Queck" <Ra****@noemail.noemail> wrote in message
news:eH*************@TK2MSFTNGP05.phx.gbl...
do I have to do these conversions manually?


There's nothing built-in, but it really has to be one of the simplest things
to write...
Jun 12 '06 #3
Mark Rae wrote:
"Rainer Queck" <Ra****@noemail.noemail> wrote in message
news:eH*************@TK2MSFTNGP05.phx.gbl...
do I have to do these conversions manually?


There's nothing built-in, but it really has to be one of the simplest things
to write...


Sure, but it's always nice to check first to make sure you're not
re-inventing the wheel.

No, there isn't, but there should be. Just as I was surprised to find
no framework support for loading currency conversion rates and doing
currency conversions. Not that MS could somehow provide the conversions
themselves, just some kind of standard way of loading and using them
would be nice.

Same with units of measure and unit conversions: it would be nice if MS
would just build them into the framework. Yes, they're dead simple and
100% internationally standard, but then how many people have written
them over and over again, all over the world? All the more reason to
toss them in the .NET Framework, IMHO.

Jun 12 '06 #4
"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...
There's nothing built-in, but it really has to be one of the simplest
things
to write...


Sure, but it's always nice to check first to make sure you're not
re-inventing the wheel.


Quite so.
Jun 12 '06 #5
Hi Rainer,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you have a column containing data in
Metric data and you need to display and modify it in Metric/Inch accroding
to the user settings. If there is any misunderstanding, please feel free to
let me know.

Generally, you need to do the conversion from Metric to Inch and backward
yourself. But if you only need to do the display, there is a simpler
solution. You can add another column with an expression to the current
DataTable. The new expression column counts from Metric to Inch with an
expression. For example:

ExpCol.Expression = "OrigCol/2.54";

Then bind certain textbox to the ExpCol to display the inch data. However,
the expression column is read-only and you cannot modify the value directly
in that column. If user changed the value in the textbox, count the value
for the OrigCol, and modify the OrigCol in DataTable and the ExpCol value
will change automatically.

HTH.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 13 '06 #6
Hi Bruce,
There's nothing built-in, but it really has to be one of the simplest
things
to write...
Sure, but it's always nice to check first to make sure you're not
re-inventing the wheel.

You caught my thought ;-)

No, there isn't, but there should be. Just as I was surprised to find
no framework support for loading currency conversion rates and doing
currency conversions. Not that MS could somehow provide the conversions
themselves, just some kind of standard way of loading and using them
would be nice.

Same with units of measure and unit conversions: it would be nice if MS
would just build them into the framework. Yes, they're dead simple and
100% internationally standard, but then how many people have written
them over and over again, all over the world? All the more reason to
toss them in the .NET Framework, IMHO.

You have my vote on that!

Rainer
Jun 13 '06 #7
Hi Kevin,

thanks for your responds.

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> schrieb im Newsbeitrag
news:<lx**************@TK2MSFTNGXA01.phx.gbl>...
Generally, you need to do the conversion from Metric to Inch and backward
yourself. It's a pity. I am quit new to the framwork, but the functionallity I
experienced up to now is really great!
Thats why I was hoping, that this kind of "commonly needed" functinallity
would be in it. Well...
But if you only need to do the display, there is a simpler
solution. You can add another column with an expression to the current
DataTable. The new expression column counts from Metric to Inch with an
expression. For example:

ExpCol.Expression = "OrigCol/2.54"; This is how I have done it in the meanwhile.
Then bind certain textbox to the ExpCol to display the inch data. However,
the expression column is read-only and you cannot modify the value
directly
in that column. If user changed the value in the textbox, count the value
for the OrigCol, and modify the OrigCol in DataTable and the ExpCol value
will change automatically.

Yes, I think this is how I will approach the issue.

Thanks
Rainer
Jun 13 '06 #8
You're welcome, Rainer. Good luck! If you have anything unclear, please
feel free to post it in the community.

Kevin Yu
Microsoft Online Community Support

================================================== ==========================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ==========================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 14 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

52
by: piaseckiac | last post by:
I am producing a website on air and need a link to change the entire website from standard to metric for temperature, pressure, miles-kilometers, and volume. Thank you.
23
by: Brian | last post by:
Despite charset being discussed to death, and despite having followed all of those threads, I still have problems. http://www.tsmchughs.com/recipes/soda-bread This page uses iso-8859-1...
7
by: El Camino | last post by:
Howdy all Im trying to do a fairly accurate metric conversion between: inches feet yards Im pretty sure that i have the right number for conversion
4
by: Jimmy | last post by:
hi, all I attempt to use the function inch() to get the character at the current position, and compare it with a particular character like : if screen.inch(x,y) == 'F' but this method doesn't...
3
by: socondc22 | last post by:
Im stuck at this point. The way i was trying to do this was running if statement around my void function and then a else if statement around a different void function but it didnt work... right now...
3
by: headware | last post by:
I have to create some vertical text for a web page that allows users to print to labels. We decided to do this by creating an <imgtag on the web page and having the src attribute point to another...
2
by: cbmeeks | last post by:
Man, I realize I've been asking a lot of questions lately. I appreciate you guys helping me in my thought process. This time, I have a design question I want opinions on. I'm building a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.