Link to home
Start Free TrialLog in
Avatar of cmdolcet
cmdolcetFlag for United States of America

asked on

Format String

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
                Next

Open in new window

Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Hi,
You can try

_ReadingsArraylistValidated(intInnerLoop).ToString("0.0000")
_PositionReadingArraylistValidated(intInnerLoop).ToString("0.0000")
Another option is to use the Match.Round function on the numbers themselves.
Avatar of cmdolcet

ASKER

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")
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial