Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello everyone
this is my first time here and i am very new to VB
I have a temperature Sensor and i got that to work
but my question is how can i have it disply 1 number after the deciaml like this 25.5oC insted of 25.345oC
i have been all day on this and i just cant get this one please help

Thare is my code for the Temp Sensor
<br />Private Sub phidgetIFK_SensorChange(ByVal sender As Object, ByVal e As Phidgets.Events.SensorChangeEventArgs) Handles phidgetIFK.SensorChange<br />        Dim temperature As String<br />        phidgetIFK.sensors(0).Sensitivity = 2 '<br />        temperature = ((phidgetIFK.sensors(0).Value * 0.2222) - 61.111)<br />        txtNumSensors.Text = temperature.ToString()<br />    End Sub<br />


Thanks in advance
Y
Posted

1 solution

You can use the Format method on the string class to specify how many decimal places to use.

Dim strPrice As String = dblPrice.ToString("0.0")

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900