473,799 Members | 3,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change value into exponential form

1 New Member
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 2507
kadghar
1,295 Recognized Expert Top Contributor
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
3517
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 shown below. When someone enters an URL to text box, and hits return or clicks on "go" button, browser would load desired page (but without opening new page). <form name="enter_url">
4
4136
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 the NO radio button, once I do that it will not work. Any help would be greatly appreciated. Mitch
1
3777
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 minIOPort); bool flag = ThreadPool.SetMinThreads(4, minIOPort); ThreadPool.GetAvailableThreads(out newWorker, out newIOPort); After running this flag is true, but the worker value is still set to 25. I am using .Net 1.1.4322 and this call was...
1
1731
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
5352
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 so, I don't know the syntax to do this. Simplified code. A form with one control - a textbox. After the user submits the form, I can get the textbox value. How would I send a string back to this same textbox to overwrite the user-entered value? ...
3
2137
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 TableCell; DataGridItem item = cell.Parent as DataGridItem; int index = item.ItemIndex;
2
2258
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? "Curtis" <curtsfakeguy@hotmail.com> wrote in message
0
1840
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 XPath to select the 2 XML elements and updating. But as far as I know, you can only update elements after selection with XPath if you use the JDOM XPath class. Using the JDOM XPath class implicates that you first have to build a JDOM in memory tree...
1
21911
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
2631
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
9688
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10259
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4145
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.