以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 表控件的名称问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=70302) |
-- 作者:dm168 -- 发布时间:2015/6/18 15:43:00 -- 表控件的名称问题 我在窗口中加入表控件 表类型normal 做为副本= true下面这代码总是提示找不到表名InfoBranchDepartment_TableDepartmen我这是什么地方错了? If Tables("InfoBranchDepartment_TableDepartment").Rows.Count = 0 Then \'\'如果是一个空表 Tables("InfoBranchDepartment_TableDepartmen").AddNew() Else If Tables("InfoBranchDepartment_TableDepartmen").Current.Isnull("Code") Then \'如果当前行code必填列是空,禁止增加行 Tables("InfoBranchDepartment_TableDepartmen").AllowAddNew = False Functions.Execute("MessageBox","""编码""是必填项"," Prompt","OK", "Information") ElseIf Tables("InfoBranchDepartment_TableDepartmen").Current.Isnull("Name") Then Tables("InfoBranchDepartment_TableDepartmen").AllowAddNew = False Functions.Execute("MessageBox","""名称""是必填项"," Prompt","OK", "Information") Else Tables("InfoBranchDepartment_TableDepartmen").AddNew() End If End If |
-- 作者:Bin -- 发布时间:2015/6/18 15:45:00 -- 窗口没打开? |
-- 作者:大红袍 -- 发布时间:2015/6/18 15:54:00 -- 1、InfoBranchDepartment窗口没打开
2、窗口名、表名没写对。 |
-- 作者:dm168 -- 发布时间:2015/6/18 16:10:00 -- 这个代码是在按钮中的,核对窗口名后改了一下,现在提示 Index -1 is either negative or above rows count. 这是哪里出错了
|
-- 作者:Bin -- 发布时间:2015/6/18 16:14:00 -- 不存在-1行.. 你取行的下标不对 |
-- 作者:dm168 -- 发布时间:2015/6/18 16:24:00 -- 能据体说一下我这代码错在什么地方吗? If Tables("InfoBranchDepartment_TableBD").Rows.Count = 0 Then \'\'如果是一个空表 Tables("InfoBranchDepartment_TableBD").AddNew() Else If Tables("InfoBranchDepartment_TableBD").Current.Isnull("Code") Then \'如果当前行code必填列是空,禁止增加行 Tables("InfoBranchDepartment_TableBD").AllowAddNew = False Functions.Execute("MessageBox","""编码""是必填项"," Prompt","OK", "Information") ElseIf Tables("InfoBranchDepartment_TableBD").Current.Isnull("Name") Then Tables("InfoBranchDepartment_TableBD").AllowAddNew = False Functions.Execute("MessageBox","""名称""是必填项"," Prompt","OK", "Information") Else Tables("InfoBranchDepartment_TableBD").AddNew() End If End If \'启用控件 e.Form.Controls("TbxCode").Enabled = True e.Form.Controls("TbxName").Enabled = True e.Form.Controls("CbxQuality").Enabled = True e.Form.Controls("TbxInCharge").Enabled = True e.Form.Controls("TbxSuperior").Enabled = True e.Form.Controls("TbxTelephone").Enabled = True e.Form.Controls("TbxAddress").Enabled = True e.Form.Controls("TbxEmail").Enabled = True e.Form.Controls("TbxMobileNo").Enabled = True \'如果启用编码列就选择该控件 If e.Form.Controls("TbxCode").Enabled = True Then e.Form.Controls("TbxCode").Select e.Form.Controls("TbxCode").HideToolTip End If \'如果是最后一行是空 Dim r As Row = Tables("InfoBranchDepartment_TableBD").Rows(Tables("InfoBranchDepartment_TableBD").Rows.Count - 1)\'获得最后一行 If r.Isnull("Code") OrElse r.Isnull("Name") Then e.Form.Controls("BntDelete").Enabled = False e.Form.Controls("BntModify").Enabled = False End If |
-- 作者:大红袍 -- 发布时间:2015/6/18 16:26:00 -- Dim r As Row = Tables("InfoBranchDepartment_TableBD").Rows(Tables("InfoBranchDepartment_TableBD").Rows.Count - 1)\'获得最后一行
-------------------------
If Tables("InfoBranchDepartment_TableBD").Rows.Count > 0 Then Dim r As Row = Tables("InfoBranchDepartment_TableBD").Rows(Tables("InfoBranchDepartment_TableBD").Rows.Count - 1)\'获得最后一行
End If |
-- 作者:dm168 -- 发布时间:2015/6/18 17:45:00 -- 现在的问题是点击按钮后,文本控件启用了,但没有正常加入行,这又是哪儿不对呢? If Tables("InfoBranchDepartment_TableBD").Rows.Count = 0 Then \'如果是一个空表 Tables("InfoBranchDepartment_TableBD").AddNew() Else Dim r As Row = Tables("InfoBranchDepartment_TableBD").Rows(Tables("InfoBranchDepartment_TableBD").Rows.Count - 1)\'获得最后一行 If r.Isnull("Code") OrElse r.Isnull("Name") Then e.Form.Controls("BntSave").Enabled = True End If \'如果当前行code必填列是空,禁止增加行 If Tables("InfoBranchDepartment_TableBD").Current.Isnull("Code") Then Tables("InfoBranchDepartment_TableBD").AllowAddNew = False Functions.Execute("MessageBox","""编码""是必填项"," Prompt","OK", "Information") ElseIf Tables("InfoBranchDepartment_TableBD").Current.Isnull("Name") Then Tables("InfoBranchDepartment_TableBD").AllowAddNew = False Functions.Execute("MessageBox","""名称""是必填项"," Prompt","OK", "Information") Else Tables("InfoBranchDepartment_TableBD").AddNew() End If End If \'启用控件 e.Form.Controls("TbxCode").Enabled = True e.Form.Controls("TbxName").Enabled = True e.Form.Controls("CbxQuality").Enabled = True e.Form.Controls("TbxInCharge").Enabled = True e.Form.Controls("TbxSuperior").Enabled = True e.Form.Controls("TbxTelephone").Enabled = True e.Form.Controls("TbxAddress").Enabled = True e.Form.Controls("TbxEmail").Enabled = True e.Form.Controls("TbxMobileNo").Enabled = True [此贴子已经被作者于2015/6/18 17:49:04编辑过]
|
-- 作者:dm168 -- 发布时间:2015/6/18 17:47:00 -- 在文本框回车后,提示 index 0 does not have a value [此贴子已经被作者于2015/6/18 17:48:21编辑过]
|
-- 作者:大红袍 -- 发布时间:2015/6/18 17:52:00 -- 这段代码应该没问题,有问题,可能是你 InfoBranchDepartment 表的 datarowAdded事件有问题。 |