Johnny
asked on
how to not have 9.0 (need to display 9) but have 9.3 display if present(vb.net-2008-windows form)
i have a display problem i want to display a number as the whole number and if a #.0 is present display it as # no decimal but if 9.3 then display #.3
code below prints 9.0 now and not 9 (bare in mind again i need to display 9.3 if present)
thanks in advance for any code or help you mat provide
ps: if i didnt explain this right please ask me ill try better
code below prints 9.0 now and not 9 (bare in mind again i need to display 9.3 if present)
thanks in advance for any code or help you mat provide
ps: if i didnt explain this right please ask me ill try better
Result_Box.AppendText("PackageDimensions.Length: " & item.ItemAttributes.PackageDimensions.Length.Value & vbCrLf)
Dim b_Length As Decimal = FormatNumber(CStr(CDbl(((item.ItemAttributes.PackageDimensions.Length.Value) / 100))), 2)
Result_Box.AppendText("PackageDimensions.Length - inches: " & b_Length.ToString & vbCrLf)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As you only want 1 decimal place it should be: 0.#
Try this
Dim test as Double = 9.0
If Integer.Parse(test.tostrin g.split(". ")(1)) > 0 Then
'the value needs the decimal point
Else
'value can be converted to integer
End if
Dim test as Double = 9.0
If Integer.Parse(test.tostrin
'the value needs the decimal point
Else
'value can be converted to integer
End if
ASKER
thx ever so much
ASKER
AlexCode: was simpler CodeCruiser: thx