注册 登录
编程论坛 VFP论坛

文本框显示问题

tjdeming 发布于 2023-09-08 21:58, 624 次点击
只有本站会员才能查看附件,请 登录
求助各位:想解决文本框显示问题:计算结果显示在文本框中,数据要 显示为整数,若是0 则文本框不显示。
如何做到?
10 回复
#2
sdta2023-09-08 22:28
试试
      For FSQ =1 to 6
           FS="fsq"+allt(str(FSQ))
            h="text"+Allt(Str(FSQ))+"."
            ThisForm.&h.Value=iif(val(fs) = 0, "", &FS)
     endfor      
#3
laowan0012023-09-09 08:04
转换成字符串显示,根据结果判断是否显示数值(0值显示'')
#4
tjdeming2023-09-09 09:27
回复 2楼 sdta
谢谢你,试了点击计算后没有反应
只有本站会员才能查看附件,请 登录
我用的是vfp6.0
#5
吹水佬2023-09-09 11:50
0不显示,textbox的Format属性为“Z”
显示整数,ThisForm.&h.Value=INT(&FS)
#6
sdta2023-09-09 11:53
ThisForm.&h..Value=iif(val(fs) = 0, "", &FS)
#7
tjdeming2023-09-09 12:26
回复 6楼 sdta
程序代码:
For FSQ =1 to 6
           FS="fsq"+allt(str(FSQ))
            h="text"+Allt(Str(FSQ))+"."
            ThisForm.&h.Value=iif(val(fs)=0, "", &FS)
     endfor      
还是没有反应
#8
sdta2023-09-09 13:43
认真看6楼代码
#9
tjdeming2023-09-09 14:19
程序代码:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form
    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"

    ADD OBJECT command1 AS commandbutton WITH ;
        Top = 12, ;
        Left = 54, ;
        Height = 36, ;
        Width = 157, ;
        Caption = "计算", ;
        Name = "Command1"
    ADD OBJECT text1 AS textbox WITH ;
        FontName = "楷体", ;
        FontSize = 12, ;
        Format = "", ;
        Height = 37, ;
        Left = 48, ;
        Top = 84, ;
        Width = 121, ;
        ForeColor = RGB(255,0,0), ;
        Name = "Text1"
    ADD OBJECT text2 AS textbox WITH ;
        FontName = "楷体", ;
        FontSize = 12, ;
        Format = "", ;
        Height = 37, ;
        Left = 48, ;
        Top = 144, ;
        Width = 121, ;
        ForeColor = RGB(255,0,0), ;
        Name = "Text2"
    ADD OBJECT text3 AS textbox WITH ;
        FontName = "楷体", ;
        FontSize = 12, ;
        Format = "", ;
        Height = 37, ;
        Left = 240, ;
        Top = 84, ;
        Width = 121, ;
        ForeColor = RGB(255,0,0), ;
        Name = "Text3"
    ADD OBJECT text4 AS textbox WITH ;
        FontName = "楷体", ;
        FontSize = 12, ;
        Format = "", ;
        Height = 37, ;
        Left = 240, ;
        Top = 156, ;
        Width = 121, ;
        ForeColor = RGB(255,0,0), ;
        Name = "Text4"


    ADD OBJECT text5 AS textbox WITH ;
        FontName = "楷体", ;
        FontSize = 12, ;
        Format = "", ;
        Height = 36, ;
        Left = 48, ;
        Top = 204, ;
        Width = 120, ;
        ForeColor = RGB(255,0,0), ;
        Name = "Text5"


    ADD OBJECT text6 AS textbox WITH ;
        FontName = "楷体", ;
        FontSize = 12, ;
        Format = "", ;
        Height = 34, ;
        Left = 240, ;
        Top = 206, ;
        Width = 121, ;
        ForeColor = RGB(255,0,0), ;
        Name = "Text6"


    ADD OBJECT command2 AS commandbutton WITH ;
        Top = 12, ;
        Left = 244, ;
        Height = 37, ;
        Width = 121, ;
        Caption = "关闭", ;
        Name = "Command2"


    PROCEDURE command1.Click

        set talk off
        use jj
        Sum 病假,事假,婚假,丧假,探亲,旷工;
            to fsq1,fsq2,fsq3,fsq4,fsq5,fsq6
        *!*      For FSQ = 1 to 6
        *!*            FS="fsq"+allt(str(FSQ))
        *!*             h="text"+Allt(Str(FSQ))+"."
        *!*          ThisForm.&h.Value=int(&FS)
        *!*      endfor      
            
             For  FSQ =1 to 6
                    FS="fsq" +allt(str(FSQ))
                     h="text"+Allt(Str(FSQ))+"."
                 ThisForm.&h.Value=iif(val(fs)=0, "", &FS)
             endfor      
    ENDPROC


    PROCEDURE command2.Click
        quit
    ENDPROC


ENDDEFINE

#10
吹水佬2023-09-09 15:04
ThisForm.&h.Value=iif(EVALUATE(fs)=0, "", &FS)
#11
tjdeming2023-09-09 15:27
回复 10楼 吹水佬
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录
1