[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

gcvt with VB.NET

Posted on 2006-11-29
3
Medium Priority
?
365 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 2000 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month19 days, 21 hours left to enroll

872 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