?
Solved

gcvt with VB.NET

Posted on 2006-11-29
3
Medium Priority
?
351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

777 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