mysql服务无法启动:VB中,怎样把TEXT控件属性改为单精度型?

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/06 06:27:19
大侠帮帮忙,小弟不会才问的,最好把代码介绍给小弟

控件本身只能是字符串类型,要获得单精度型数据需手动在代码中进行类型转换。

使用代码对输入数据进行类型转换,如果你需要的是将数据转换为Single类型的话,下面的这段引自MSDN的话可能对你有帮助
CSng
Returns an expression that has been converted to a Variant of subtype Single.

Syntax
CSng(expression)

The expression argument is any valid expression.

Remarks
In general, you can document your code using the data type conversion functions to show that the result of some operation should be expressed as a particular data type rather than the default data type. For example, use CDbl or CSng to force double-precision or single-precision arithmetic in cases where currency or integer arithmetic normally would occur.

Use the CSngto provide internationally aware conversions from any other data type to a Single subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system, as are different thousand separators.

If expression lies outside the acceptable range for the Single subtype, an error occurs.