标题:在表格Grid上增加Combo1
只看楼主
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:190
帖 子:3125
专家分:8340
注 册:2015-3-25
结帖率:98.96%
已结贴  问题点数:20 回复次数:4 
在表格Grid上增加Combo1
怎样在Grid上动态增加Combo1,同时显示字段原来内容,也有选择"男","女"
tb(id,name,sex)
001,张三,男
002,李四,女
003,王五,男
thisform.grid1.ColumnCount = -1
thisform.grid1.RecordSourceType = 1
thisform.grid1.RecordSource = "tb"

 WITH thisform.grid1.Columns[3]
    .AddObject('Combo1','ComboBox')
    .CurrentControl = 'Combo1'
    .Combo1.Visible = .t.
    .Sparse = .f.
    .Combo1.borderstyle = 0
    .Combo1.additem("男")
    .Combo1.additem("女")
 ENDWITH
上面出来的,表格是
001,张三,男
002,李四,男
003,王五,男
不是我要的
001,张三,男
002,李四,女
003,王五,男
搜索更多相关主题的帖子: 表格 Grid 增加 name thisform 
2017-10-26 00:31
xinjie
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:18
帖 子:257
专家分:501
注 册:2007-8-11
得分:5 

执行后比较一下。
2017-10-26 01:30
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:15 
        thisform.grid1.ColumnCount = -1
        thisform.grid1.RecordSourceType = 1
        thisform.grid1.RecordSource = "tb"
        WITH thisform.grid1.Columns[3]
            .RemoveObject("Text1")            
            .AddObject('Combo1','ComboBox')
            .ControlSource = "tb.sex"
            .Sparse = .f.
            .Width = 40
            .Combo1.borderstyle = 0
            .Combo1.Style = 2
            .Combo1.RowSourceType = 1
            .Combo1.RowSource = "男,女"
            .Combo1.Visible = .t.
        ENDWITH
2017-10-26 04:51
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:190
帖 子:3125
专家分:8340
注 册:2015-3-25
得分:0 
thisform.grid1.ColumnCount = -1
        thisform.grid1.RecordSourceType = 1
        thisform.grid1.RecordSource = "tb"
        WITH thisform.grid1.Columns[3]
            .RemoveObject("Text1")    &&同时还要删除他
            .AddObject('Combo1','ComboBox')
            .ControlSource = "tb.sex" &&不能这样.CurrentControl = 'Combo1'
            .Sparse = .f.
            .Width = 40
            .Combo1.borderstyle = 0
            .Combo1.Style = 2
            .Combo1.RowSourceType = 1
            .Combo1.RowSource = "男,女"
            .Combo1.Visible = .t.
        ENDWITH
2017-10-26 08:34
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:190
帖 子:3125
专家分:8340
注 册:2015-3-25
得分:0 
动态增加的ComboBox的InteractiveChange事件,除了绑定,或者自己封装类,还有什么办法在这里修改?
2017-10-26 08:37



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




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

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