主题:表格显示如何去掉小数点后面多余的 0
lzguang
[专家分:1210] 发布于 2009-01-20 16:57:00
如 1.000 只显示 1
0.250 只显示 0.25
回复列表 (共16个回复)
11 楼
cbl518 [专家分:57140] 发布于 2009-02-01 09:18:00
设定 Column2.DynamicInputMask 属性,
第一列(数据型的字段)单元格中能录入数字型数据!
12 楼
lzguang [专家分:1210] 发布于 2009-02-02 20:26:00
cbl518 老师您好,真不知如何“设定 Column2.DynamicInputMask 属性”能说详细一点吗?谢谢了!!
13 楼
lzguang [专家分:1210] 发布于 2009-02-02 20:28:00
cbl518 老师您好,真不知如何“设定 Column2.DynamicInputMask 属性”能说详细一点吗?谢谢了!!
14 楼
cbl518 [专家分:57140] 发布于 2009-02-02 23:30:00
对不起写错了:
“设定 Column2.DynamicInputMask 属性”
应该是:
“设定 Column1.DynamicInputMask 属性”
15 楼
cbl518 [专家分:57140] 发布于 2009-02-02 23:30:00
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
Caption = "Form1"
Name = "Form1"
ADD OBJECT grid1 AS grid WITH ;
ColumnCount = -1,DeleteMark = .F.,Height = 181,Left = 24,Top = 12,Width = 337,Name = "Grid1"
ADD OBJECT command1 AS commandbutton WITH Top = 203,Left = 24,Height = 25,Width = 97,Caption = "添加新纪录",Name = "Command1"
ADD OBJECT command2 AS commandbutton WITH Top = 201,Left = 133,Height = 25,Width = 97,Caption = "修改第一条纪录",Name = "Command2"
PROCEDURE Load
CREATE TABLE g:\temp\tabl0 (n1 N(8,3),b2 C(12),c2 C(12),d2 C(12))
FOR i0 =1 to 10
INSERT into tabl0 valu(0.210,"1234","5678","90")
INSERT into tabl0 valu(1.0,"ASDf","ghj","kl")
INSERT into tabl0 valu(0,"ASDf","ghj","kl")
INSERT into tabl0 valu(0.800,"ASDf","ghj","kl")
ENDFOR
1
ENDPROC
PROCEDURE grid1.Init
this.column1.DynamicInputMask="IIF(n1%1=0,'9999','9999.'+PADL('9',LEN(TRIM(TRAN(n1),1,'0'))-LEN(TRAN(INT(n1)))-1,'9'))"
ENDPROC
PROCEDURE command1.Click
INSERT INTO tabl0 (n1,b2) VALUES (RAND()*1000,"新纪录")
this.Parent.grid1.column1.SetFocus
ENDPROC
PROCEDURE command2.Click
GO 1
REPLACE n1 WITH RAND()*100
this.Parent.grid1.column1.SetFocus
ENDPROC
ENDDEFINE
16 楼
lzguang [专家分:1210] 发布于 2009-02-03 13:01:00
cbl518 老师高人!!先研究一下!
我来回复