Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Format String

Posted on 2009-04-20
Medium Priority
Last Modified: 2013-11-26
How can I format the CStr(_PositionReadingArraylistValidated(intInnerLoop)) and the CStr(_ReadingArrayList3(intInnerLoop)) to 4 decimal places????
For intInnerLoop = 0 To _partfile.gageList.Count - 1
                    valuetemp1 = _PositionReadingArraylistValidated(intInnerLoop)
                    valuetemp2 = _ReadingsArraylistValidated(intInnerLoop)
                    valuetemp3 = valuetemp2 - valuetemp1
                    strText += CStr(_PositionReadingArraylistValidated(intInnerLoop)) & vbTab & valuetemp2 & vbTab & CStr(_ReadingArrayList3(intInnerLoop)) & vbTab & valuetemp3 & vbCrLf

Open in new window

Question by:cmdolcet
  • 2
LVL 48

Expert Comment

ID: 24185576
You can try

LVL 83

Expert Comment

ID: 24192340
Another option is to use the Match.Round function on the numbers themselves.

Author Comment

ID: 24194113
jp,when i change the code around i get an error: Value of type String cannot be converted to System.IformatProvider.

using: CStr(_ReadingArrayList3(intInnerLoop)).ToString("0.0000")
LVL 48

Accepted Solution

jpaulino earned 1000 total points
ID: 24194186
Try this way:

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses

578 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