标题:求助:关于表修改的问题
取消只看楼主
zyangxiao
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2019-6-16
结帖率:100%
已结贴  问题点数:20 回复次数:2 
求助:关于表修改的问题
新手求教。
问题1 如图,如何实现鼠标点到左表任一记录,在右侧文本框中对应显示相应记录,而不是用上一条或下一条记录挨个翻。



问题2 当我任选一条记录删除后,左表显示空白,如何在删除后让左表显示正常数据。

请各位大神帮忙找一下问题所在,谢谢!!!

PUBLIC oform1

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


    **************************************************
*-- Form:         form1 (d:\vfp应用\学生成绩管理系统\form\f_user.scx)
*-- 父类:  form
*-- 基类:    form
*
DEFINE CLASS form1 AS form


    Height = 388
    Width = 602
    DoCreate = .T.
    AutoCenter = .T.
    Caption = "用户管理"
    Name = "Form1"


    ADD OBJECT shape2 AS shape WITH ;
        Top = 72, ;
        Left = 372, ;
        Height = 144, ;
        Width = 181, ;
        BackStyle = 0, ;
        SpecialEffect = 0, ;
        Name = "Shape2"


    ADD OBJECT shape1 AS shape WITH ;
        Top = 72, ;
        Left = 24, ;
        Height = 228, ;
        Width = 312, ;
        BackStyle = 0, ;
        SpecialEffect = 0, ;
        Name = "Shape1"


    ADD OBJECT grduser AS grid WITH ;
        ColumnCount = 3, ;
        Height = 200, ;
        Left = 42, ;
        RecordSource = "user", ;
        RecordSourceType = 1, ;
        Top = 86, ;
        Width = 276, ;
        Name = "grdUser", ;
        Column1.ControlSource = "user.账号", ;
        Column1.Name = "Column1", ;
        Column2.ControlSource = "user.真实姓名", ;
        Column2.Name = "Column2", ;
        Column3.ControlSource = "user.密码", ;
        Column3.Name = "Column3"


    ADD OBJECT form1.grduser.column1.header1 AS header WITH ;
        Caption = "账号", ;
        Name = "Header1"


    ADD OBJECT form1.grduser.column1.text1 AS textbox WITH ;
        BorderStyle = 0, ;
        Margin = 0, ;
        ForeColor = RGB(0,0,0), ;
        BackColor = RGB(255,255,255), ;
        Name = "Text1"


    ADD OBJECT form1.grduser.column2.header1 AS header WITH ;
        Caption = "真实姓名", ;
        Name = "Header1"


    ADD OBJECT form1.grduser.column2.text1 AS textbox WITH ;
        BorderStyle = 0, ;
        Margin = 0, ;
        ForeColor = RGB(0,0,0), ;
        BackColor = RGB(255,255,255), ;
        Name = "Text1"


    ADD OBJECT form1.grduser.column3.header1 AS header WITH ;
        Caption = "密码", ;
        Name = "Header1"


    ADD OBJECT form1.grduser.column3.text1 AS textbox WITH ;
        BorderStyle = 0, ;
        Margin = 0, ;
        ForeColor = RGB(0,0,0), ;
        BackColor = RGB(255,255,255), ;
        Name = "Text1"


    ADD OBJECT txt账号 AS textbox WITH ;
        Comment = "", ;
        ControlSource = "user.账号", ;
        Enabled = .T., ;
        Height = 20, ;
        Left = 456, ;
        MaxLength = 10, ;
        TabIndex = 3, ;
        Top = 93, ;
        Width = 72, ;
        Name = "txt账号"


    ADD OBJECT lbl账号 AS label WITH ;
        AutoSize = .T., ;
        WordWrap = .T., ;
        BackStyle = 0, ;
        Caption = "账   号", ;
        Height = 16, ;
        Left = 394, ;
        Top = 95, ;
        Width = 42, ;
        TabIndex = 2, ;
        Name = "lbl账号"


    ADD OBJECT txt真实姓名 AS textbox WITH ;
        Comment = "", ;
        ControlSource = "user.真实姓名", ;
        Enabled = .T., ;
        Height = 20, ;
        Left = 456, ;
        MaxLength = 8, ;
        TabIndex = 5, ;
        Top = 132, ;
        Width = 72, ;
        Name = "txt真实姓名"


    ADD OBJECT lbl真实姓名 AS label WITH ;
        AutoSize = .T., ;
        WordWrap = .T., ;
        BackStyle = 0, ;
        Caption = "真实姓名", ;
        Left = 394, ;
        Top = 134, ;
        Width = 48, ;
        TabIndex = 4, ;
        Name = "lbl真实姓名"


    ADD OBJECT txt密码 AS textbox WITH ;
        Comment = "", ;
        ControlSource = "user.密码", ;
        Enabled = .T., ;
        Height = 20, ;
        Left = 456, ;
        MaxLength = 10, ;
        TabIndex = 7, ;
        Top = 169, ;
        Width = 72, ;
        Name = "txt密码"


    ADD OBJECT lbl密码 AS label WITH ;
        AutoSize = .T., ;
        WordWrap = .T., ;
        BackStyle = 0, ;
        Caption = "密   码", ;
        Height = 16, ;
        Left = 394, ;
        Top = 171, ;
        Width = 42, ;
        TabIndex = 6, ;
        Name = "lbl密码"


    ADD OBJECT command4 AS commandbutton WITH ;
        AutoSize = .F., ;
        Top = 312, ;
        Left = 504, ;
        Height = 30, ;
        Width = 60, ;
        FontSize = 11, ;
        Caption = "退出", ;
        Name = "Command4"


    ADD OBJECT command3 AS commandbutton WITH ;
        AutoSize = .F., ;
        Top = 312, ;
        Left = 432, ;
        Height = 30, ;
        Width = 60, ;
        FontSize = 11, ;
        Caption = "删除", ;
        Name = "Command3"


    ADD OBJECT command1 AS commandbutton WITH ;
        AutoSize = .F., ;
        Top = 312, ;
        Left = 288, ;
        Height = 30, ;
        Width = 60, ;
        FontSize = 11, ;
        Caption = "添加", ;
        Name = "Command1"


    ADD OBJECT commandgroup1 AS commandgroup WITH ;
        AutoSize = .F., ;
        ButtonCount = 4, ;
        Value = 1, ;
        Height = 35, ;
        Left = 336, ;
        Top = 252, ;
        Width = 265, ;
        Name = "Commandgroup1", ;
        Command1.AutoSize = .F., ;
        Command1.Top = 5, ;
        Command1.Left = 5, ;
        Command1.Height = 25, ;
        Command1.Width = 60, ;
        Command1.Caption = "首记录", ;
        Command1.Name = "Command1", ;
        Command2.AutoSize = .F., ;
        Command2.Top = 5, ;
        Command2.Left = 70, ;
        Command2.Height = 25, ;
        Command2.Width = 60, ;
        Command2.Caption = "末记录", ;
        Command2.Name = "Command2", ;
        Command3.AutoSize = .F., ;
        Command3.Top = 5, ;
        Command3.Left = 135, ;
        Command3.Height = 25, ;
        Command3.Width = 60, ;
        Command3.Caption = "上一条", ;
        Command3.Name = "Command3", ;
        Command4.AutoSize = .F., ;
        Command4.Top = 5, ;
        Command4.Left = 200, ;
        Command4.Height = 25, ;
        Command4.Width = 60, ;
        Command4.Caption = "下一条", ;
        Command4.Name = "Command4"


    ADD OBJECT command2 AS commandbutton WITH ;
        AutoSize = .F., ;
        Top = 312, ;
        Left = 360, ;
        Height = 30, ;
        Width = 60, ;
        FontSize = 11, ;
        Caption = "插入", ;
        Name = "Command2"


    PROCEDURE command4.Click
        thisform.release
    ENDPROC


    PROCEDURE command3.Click
        delete
        pack
        thisform.refresh
    ENDPROC


    PROCEDURE command1.Click
        append blank
        goto bottom
        thisform.refresh
    ENDPROC


    PROCEDURE
        go top
        this.enabled=.F.
        
        
        
        thisform.refresh
    ENDPROC


    PROCEDURE
        go bottom
        this.enabled=.F.
        
        
        
        thisform.refresh
    ENDPROC


    PROCEDURE
        skip-1
        if bof()
           messagebox("已是第一条记录",48,"信息窗口")
           this.enabled=.F.
           
           
           
        else
           this.enabled=.T.
           
           
           
          thisform.refresh
        endif
    ENDPROC


    PROCEDURE
        skip 1
        if eof()
           messagebox("已是最后一条记录",48,"信息窗口")
           this.enabled=.F.
           
           
           
        else
           this.enabled=.T.
           
           
           
          thisform.refresh
        endif
    ENDPROC


    PROCEDURE command2.Click
        insert before blank
        thisform.refresh
    ENDPROC


ENDDEFINE
*
*-- 结束定义: form1
**************************************************
搜索更多相关主题的帖子: OBJECT Name ADD WITH thisform 
2019-06-20 09:40
zyangxiao
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2019-6-16
得分:0 
请问Grid的AfterRowColChange事件中怎么处理?
2019-06-20 13:45
zyangxiao
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2019-6-16
得分:0 
各位大神,我是一个初学者,窗口是可视化设置的,只是功能按钮代码是自己编的,代码是从类浏览库中自动生成的,为了方便各位帮忙查找问题。
所以一些基础知识还不是太明白,自己自学很慢,慢慢摸索,还请各位大神多多指教。
问题再重复一下
问题1 如图,如何实现鼠标点到左表任一记录,在右侧文本框中对应显示相应记录,而不是用上一条或下一条记录挨个翻。
问题2 当我任选一条记录删除后,左表显示空白,如何在删除后让左表显示正常数据。
还请各位大神详细讲解,再次感谢!!
2019-06-21 09:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-495384-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.368722 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved