How to change text values to 3 decimal places in autocad using vb.net

How to change text values to 3 decimal places in autocad using vb.net

Anonymous
Not applicable
2,461 Views
5 Replies
Message 1 of 6

How to change text values to 3 decimal places in autocad using vb.net

Anonymous
Not applicable

hi every one

 

i have an array with some text values like elevation levels as

88, 92.19, 100.003, 102.1, ...................so on

i am using text as single line text

 dim Text1 As DBText = New DBText()

if i use as above, it is not inserting 3 decimal place 

i want to insert the text with 3 decimal places after the point as below

88.000

92.190

100.003

102.100

please help me how can i do it 

 

thanks in advance

gvg

 

 

 

0 Likes
Accepted solutions (3)
2,462 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

please help me how to do it the same

 

 

0 Likes
Message 3 of 6

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

please find >>>here<<< the syntax for String.Format.

 

The value has to be a double value, then you can use:

TestStr = Format(YourDoubleValue, "###0.000")

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 4 of 6

fieldguy
Advisor
Advisor
Accepted solution

To add to the reply from @Alfred.NESWADBA, if your elevations are not doubles, you could use >>convert<< if you are sure they are valid, or >>tryparse<< 

something like

Text1.Textstring = convert.todouble(elev).tostring("0.000")

 

0 Likes
Message 5 of 6

Anonymous
Not applicable
0 Likes
Message 6 of 6

Anonymous
Not applicable
Accepted solution

thanks you fieldguy for your reply

Text1.Textstring = convert.todouble(elev).tostring("0.000")

your solution also satisfies my requirement.

0 Likes