.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using Runtime Converter to Convert to Fractional Inches

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Rob.O
464 Views, 2 Replies

Using Runtime Converter to Convert to Fractional Inches

Hi All,

 

I am using the Runtime Converter to convert decimal/architectural values, but I am stumped on how to convert a value to an all inch value.

 

I need a value such as 99.5 to convert to a string value of 99 1/2", but am not having any luck.  If I use DistanceUnitFormat.Architectural, it returns 8'-3 1/2".

 

I am sure I can achieve what I want by splitting the string out and adding the various parts, but I want to avoid the drain bamage of doing so if there is an easier way.

 

Any ideas how I can convert to an all inch format?

 

Thanks!

 

 

 

2 REPLIES 2
Message 2 of 3
Mike.Wohletz
in reply to: Rob.O

Take a look at this: http://www.vbforums.com/showthread.php?p=3917017 

You can call it something like I have shown below and get what you are looking for, there is probably a better way to get this but this worked on the first try so that is what I am sending.

 

   Dim intSize As Double = 99.5
        Dim intDecimal As Double = CType(intSize.ToString.Substring(intSize.ToString.IndexOf(".")), Double)
        Dim intHole As Double = intSize - intDecimal

        MsgBox(intHole & " " & dec2frac(intDecimal) & Chr(34))

 

 

Message 3 of 3
Rob.O
in reply to: Mike.Wohletz

Thanks Mike... just what I was looking for!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost