Solved

gcvt with VB.NET

Posted on 2006-11-29
3
335 Views
Last Modified: 2012-08-14
How would I convert the C function gcvt() to VB.NET?

For example, it is something like this now:

gcvt(myDouble, 5, myString)

Where 5 is the number of digits, not necessarily the number of characters.
0
Comment
Question by:GivenRandy
  • 2
3 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 18044833
gcvt converts a double to string.  That is pretty simply in VB.NET:

Dim myDouble As Double = 5.234
Dim myString As String = myDouble.ToString("N3")

Bob
0
 
LVL 9

Author Comment

by:GivenRandy
ID: 18044974
That's not quite the equivalent and is similar to what I was already doing. I might have to settle for that at the moment. Here's a google result for gcvt():

http://www.cplusplus.com/ref/cstdlib/gcvt.html
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18045006
The ToString has many different formats, and if you are looking for the exact gvct, then you could do something like this:

   gcvt (1365.249,6,buffer);  ===> ToString("N2") or ToString("####.##")

Bob

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now