473,385 Members | 1,958 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,385 software developers and data experts.

Change value into exponential form

I have a double type variable Sum and more than 1 textbox. When i divide one textbox value to another textbox value i got result of this type .00000000438000 and assign this value to another textbox. I want to change this value into exponentional form like 4.3*10-9. In which way i will change this value. I m trying my best effort bt i can't do this. Can someone help me?
Oct 6 '11 #1
1 2493
kadghar
1,295 Expert 1GB
VB will change it if the value is less than 1*10^-15.

Never the less, the capital "E" is recognized as a numeric value... Lets write a fast function to do that (it will return a string that can be used as a number with the VAL function for later uses)

Expand|Select|Wrap|Line Numbers
  1. Function myExponential(byval Dou1 as double) as String
  2.     Dim Exponent as integer = 0
  3.     Do
  4.         If Dou1 < 0 then
  5.             Dou1 *= 10
  6.             Exponent -= 1
  7.         ElseIf Dou1 >= 10 then
  8.             Dou1 /= 10
  9.             Exponent += 1
  10.         Else
  11.             Return Dou1.ToString & IIF(Exponent <> 0, "E" & Exponent.ToString, Nothing)
  12.     Loop
  13. End Function
Oct 11 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kuba Glad | last post by:
Hi, I've spent some time using google, and reading basic manuals about Java Scripts and forms, but I can't find solution to this simple problem. In web page I want a such type of form like...
4
by: mitch-co2 | last post by:
What I am trying to do is when someone clicks on the YES radio button I want the text field called MYTEXT to equal the text field named DATE. The below code works as long as I do NOT UN-COMMENT...
1
by: Tim Begin | last post by:
I am attempting to use the ThreadPool.SetMinThreads method as shown in the MSDN example code: int minWorker, minIOPort; int newWorker,newIOPort; ThreadPool.GetAvailableThreads(out minWorker, out...
1
by: M Shafaat | last post by:
Hi! What is a good way to detect an editting change in a form with textboxes and other editable controls? Regards M Shafaat
2
by: danparks | last post by:
I understand how to use ASP to retrieve a value from a form textbox. I don't understand how to use ASP to fill in a value in a form textbox. I'm guessing that perhaps Response.Write can be used? If...
3
by: John Smith | last post by:
I'm looking into this peace of code: protected void DropDown_SelectedIndexChanged(object sender, EventArgs e) { DropDownList list = (DropDownList)sender; TableCell cell = list.Parent as...
2
by: John Smith | last post by:
Will this line of the code: item.Cells.Text = "Some text..."; change only DataGrid visual value or it will also change value in the DataSource? How can I change value in DataSource? ...
0
by: marknoten | last post by:
Hi, we are working with XML files that can be as big as 6Mb. Some XML documents that obey to a certain condition must be duplicated where only 2 elements need to change value. I thought using...
1
by: MZ | last post by:
Hello! Is it possible to change URL form action on submit form... I have tried such code: <script language="JavaScript" type="text/javascript"> function changeURL() {
1
by: Jafri256best | last post by:
I want to change value of a variable permanently during executing a form and want to enter the value through the text box.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.