以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  生成的表 我希望不能编辑,但是不行 !还是能编辑  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=147765)

--  作者:jjun2002cn
--  发布时间:2020/3/23 17:13:00
--  生成的表 我希望不能编辑,但是不行 !还是能编辑
\'加载表格
If DataTables.Contains("Sale_List") = False Then
DataTables.Load("Sale_List")
End If

\'生成临时表

If DataTables.Contains("产品明细")= False Then
Dim dtb As New DataTableBuilder("产品明细")
dtb.AddDef("AccountID", Gettype(Integer), 32)
dtb.AddDef("ProductID", Gettype(String), 32)
dtb.AddDef("ProductName", Gettype(String))
dtb.AddDef("ProductNumber", Gettype(Double))
dtb.AddDef("ProductPrice", Gettype(Double))
dtb.AddDef("ProductTotal", Gettype(Double))
dtb.AddDef("MainMemoEx", Gettype(String))
dtb.Build()
DataTables("产品明细").AllowEdit = False

Tables("新建销售单_sale_list").DataSource =DataTables("产品明细")
Tables("新建销售单_sale_list").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductID").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductTotal").AllowEdit = False
\'\'Tables("新建销售单_sale_list").Cols("").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductName").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductName").AllowEdit = False
\'
\'

End If

Tables("新建销售单_sale_list").AddNew()
\'
\'Tables("新建销售单_Sale_List").Cols("ProductTotal").GrandTotal = True \'指定要合计的列
\'Tables("新建销售单_Sale_List").GrandTotal = True \'显示合计模式

--  作者:有点蓝
--  发布时间:2020/3/23 17:50:00
--  
在表格里还能直接编辑?我测试没有问题,上传实例看看
--  作者:jjun2002cn
--  发布时间:2020/3/23 18:41:00
--  

[此贴子已经被作者于2020/3/23 23:00:55编辑过]

--  作者:jjun2002cn
--  发布时间:2020/3/23 18:43:00
--  
请帮我看一下谢谢!我的目的是数量和价格是可以编辑的总价格是自动运算的,产品名称和编码都是只能在原有的数据库里选择!
--  作者:jjun2002cn
--  发布时间:2020/3/23 18:45:00
--  
我连的的是外部数据库!
--  作者:有点蓝
--  发布时间:2020/3/23 20:33:00
--  
连不到数据库无法测试。把窗口设计属性的允许编辑改为false试试。
--  作者:有点蓝
--  发布时间:2020/3/23 20:34:00
--  
或者代码换个位置

f DataTables.Contains("产品明细")= False Then
Dim dtb As New DataTableBuilder("产品明细")
dtb.AddDef("AccountID", Gettype(Integer), 32)
dtb.AddDef("ProductID", Gettype(String), 32)
dtb.AddDef("ProductName", Gettype(String))
dtb.AddDef("ProductNumber", Gettype(Double))
dtb.AddDef("ProductPrice", Gettype(Double))
dtb.AddDef("ProductTotal", Gettype(Double))
dtb.AddDef("MainMemoEx", Gettype(String))
dtb.Build()

End If
DataTables("产品明细").AllowEdit = False

Tables("新建销售单_sale_list").DataSource =DataTables("产品明细")
Tables("新建销售单_sale_list").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductID").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductTotal").AllowEdit = False
\'\'Tables("新建销售单_sale_list").Cols("").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductName").AllowEdit = False
\'Tables("新建销售单_sale_list").Cols("ProductName").AllowEdit = False
\'
\'
Tables("新建销售单_sale_list").AddNew()
\'
\'Tables("新建销售单_Sale_List").Cols("ProductTotal").GrandTotal = True \'指定要合计的列
\'Tables("新建销售单_Sale_List").GrandTotal = True \'显示合计模式

--  作者:jjun2002cn
--  发布时间:2020/3/23 22:58:00
--  
连不到数据库无法测试。把窗口设计属性的允许编辑改为false试试。
按照这个试了一下问题解决了! 谢谢!