小数点后一个数字? [英] One Number after Decimal Point ?

查看:70
本文介绍了小数点后一个数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,这是我第一次来VB,我很陌生.我有一个温度传感器,可以正常工作.但是我的问题是我怎么能显示1个数字?像这样的25.345oC的25.5oC的deciaml整天待在我身上之后,我只是无法得到它,请帮助

Thare是我的温度传感器代码

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 />



预先感谢
Y



Thanks in advance
Y

推荐答案

您可以在字符串类上使用Format方法来指定要使用的小数位数. br>
将strPrice用作字符串= dblPrice.ToString("0.0")

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")


这篇关于小数点后一个数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆