大红袍老师:我设了一个内部函数 打开表的全局事件
'----------打开表的全局事件--------------------------------------------------------------------------
Dim strDataTableName As String = args(0)
DataTables(strDataTableName).GlobalHandler.KeyDown = True
DataTables(strDataTableName).GlobalHandler.PrepareEdit = True
DataTables(strDataTableName).GlobalHandler.startEdit = True
DataTables(strDataTableName).GlobalHandler.afterEdit = True
'Datatables(strDataTableName).AllowCopyHeader = True '复制表中内容的时候,是否包括列名,默认为False
DataTables(strDataTableName).GlobalHandler.BeforeLoad = True
DataTables(strDataTableName).GlobalHandler.BeforeSaveDataRow = True
DataTables(strDataTableName).GlobalHandler.BeforeDeleteDataRow = True
DataTables(strDataTableName).GlobalHandler.BeforeAddDataRow = True
然后在窗体的afterload中加了下面代码, 但好象全局事件并没有绑定,请老师看看代码有什么问题?
Dim tblSenser As Table = e.Form.Controls("tblSenser").Table
'tblSenser.Fill("select [_identify],敏感ID,数据表名,列名称,说明 f rom {敏感字段}",gs_strActiveConn,False)
tblSenser.Fill("select * f rom 敏感字段",gs_strActiveConn,False)
Functions.Execute("打开表的全局事件", tblSenser.DataTable.name) '调用内部函数对新载入的表进行全局事件绑定
tblSenser.AllowAddNew=True
tblSenser.AllowEdit=True
tblSenser.AllowDelete=True
tblSenser.AllowLockRow=True '允许锁定行
tblSenser.AllowUnlockRow=True '允许解锁行
tblSenser.SetColVisibleWidth("敏感ID|80|数据表名|150|列名称|100|说明|100")
tblSenser.ExtendLastCol = True
tblSenser.Cols("敏感ID").AllowEdit = False '敏感ID不能手工编辑
tblSenser.Cols("数据表名").AllowDirectType = False '是否允许用户直接输入不在列表项目中的内容
tblSenser.Cols("列名称").AllowDirectType = False '是否允许用户直接输入不在列表项目中的内容
tblSenser.Cols("数据表名").ComboList = String.join("|",Connections(gs_strActiveConn).GetTableNames.ToArray)
tblSenser.Cols("列名称").ComboList = "" 'GetComboListColumnName(CurrentTable.Current("数据表名"),gs_strActiveConn)