I'm a chemist and I'm just having trouble with seeing numbers the way I want them.
My numbers are hydrogen ion concentrations which are from 0.1 down to 10 to the -14 (10E-14) from a pH value, which is a number between roughly 0 and 14:
pH = -(pH)
concH = Power(10, pH)
My problem comes when I try to display the number. What I really want is something on the lines of:
Hydrogen ion concentration = 1.234E-5 (or similar)
but if I just put
Label3.Text = "Hydrogen ion concentration = " & concH 'yes it's mixed types and I shouldn't .....
then I get ALL of the decimal places, most of which are useless...... 1.2345678987654321E-5
I tried
Label3.Text = "Hydrogen ion concentration = " & NumberFormat(concH,4,6)
but then I get 0.000 for most of the numbers, as it converts to decimals like 0.00000123 and then truncates. Round() gave me pretty much the same problems.
Is there a built-in function or two that will do what I want, but I can't see it?
Or is it maybe in somebody's library (I can afford the paid-for version after payday)
Or am I going to have to write my own (not an issue, just time spent)
Sorry for the long question, chaps!
My numbers are hydrogen ion concentrations which are from 0.1 down to 10 to the -14 (10E-14) from a pH value, which is a number between roughly 0 and 14:
pH = -(pH)
concH = Power(10, pH)
My problem comes when I try to display the number. What I really want is something on the lines of:
Hydrogen ion concentration = 1.234E-5 (or similar)
but if I just put
Label3.Text = "Hydrogen ion concentration = " & concH 'yes it's mixed types and I shouldn't .....
then I get ALL of the decimal places, most of which are useless...... 1.2345678987654321E-5
I tried
Label3.Text = "Hydrogen ion concentration = " & NumberFormat(concH,4,6)
but then I get 0.000 for most of the numbers, as it converts to decimals like 0.00000123 and then truncates. Round() gave me pretty much the same problems.
Is there a built-in function or two that will do what I want, but I can't see it?
Or is it maybe in somebody's library (I can afford the paid-for version after payday)
Or am I going to have to write my own (not an issue, just time spent)
Sorry for the long question, chaps!