以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  固定小数位问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=101835)

--  作者:douglas738888
--  发布时间:2017/6/8 9:40:00
--  固定小数位问题

老师,以下代码如何实现下拉combolist内容里面固定小数位

 

Dim cmd2 As New SQLCommand
Dim dt2 As DataTable
cmd2.C
cmd2.CommandText = "SELECT DISTINCT 参数计量 F rom {参数计量}"
dt2 = cmd1.ExecuteReader
Tables("因子库主表").Cols("参数计量").Combolist = dt2.SQLGetComboListString("参数计量")

 

现在下拉得到的如

0.5

1

1.2

2

2.1

3

怎样实现

0.5

1.0

1.2

2.0

2.1

3.0


--  作者:有点蓝
--  发布时间:2017/6/8 10:13:00
--  
Dim cmd2 As New SQLCommand
Dim dt2 As DataTable
cmd2.C
cmd2.CommandText = "SELECT DISTINCT 参数计量 F rom {参数计量}"
dt2 = cmd1.ExecuteReader
Dim str As String = dt2.SQLGetComboListString("参数计量")
Dim str2() As String = str.Split("|")
For i As Integer = 0 To str2.Length - 2
    str2(i) = Format(val(str2(i)),"0.0")
Next

Tables("因子库主表").Cols("参数计量").Combolist = String.Join("|",str2)