[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

gcvt with VB.NET

Posted on 2006-11-29
3
Medium Priority
?
354 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

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

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…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

649 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