以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 动态列表项目不可选(已解决) (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=26430) |
-- 作者:yyzlxc -- 发布时间:2012/12/4 12:58:00 -- 动态列表项目不可选(已解决) 在表的PrepareEdit事件加入如下代码,在“客户全称”列,可以生成动态列表项目,改变选项后,所有的按钮失效。切换表后,按钮恢复功效,加载表后,又恢复到原来的选项。而另外两张表,用同样的代码,运行正常。不知问题可能出在哪里,请各位老师指教,谢谢!! If e.IsFocusCell Then \'如果是焦点所在单元格 If e.Col.Name = "客户全称" Then \'如果正在编辑的是客户单位全称列 \'从cjml2提取该单位的客户单位全称作为列表项目 e.Col.Combolist = DataTables("cjml2").GetComboListString("客户全称", "[单位] = \'" & e.Row("单位") & "\'") End If End If
[此贴子已经被作者于2012-12-7 10:39:35编辑过]
|
-- 作者:lin_hailun -- 发布时间:2012/12/4 13:14:00 -- 改变以后出现的话,就看看datacolchanged事件代码,在看看项目属性的maintablechanged事件代码。 |
-- 作者:yyzlxc -- 发布时间:2012/12/4 13:43:00 -- 谢谢lin_hailun的提示! 该表是从Excel导入的,代码如下(应该也不会有问题): Forms("加载提示").Open() \'导入应收明细 \'获取年月 Dim ny As String With RibbonTabs("销售管理")("应收明细") ny = .Items("年月").Text End With Dim y1 As String = CInt(Left(ny,4))-1 \'生成ysmx临时表 Dim o As new QueryBuilder o.TableName = "ysmx" o.C o.SelectString = "Select DISTINCT 年月 From {应收明细} WHERE Left(年月,4)>= \'" & y1 & "\'" o.Build Dim Book As New XLS.Book(ProjectPath & "应收明细.xls") If DataTables("ysmx").Find("年月 = \'" & ny & "\'") IsNot Nothing Then Forms("加载提示").Close() messagebox.show("当月数据已导入","提示") Return End If MainTable = Tables("应收明细") For i As Integer = 0 To Book.Sheets.Count -1 Dim a As String = Book.Sheets(i).Name If a = ny Then Dim Sheet As XLS.Sheet = Book.Sheets(i) Tables("应收明细").StopRedraw() For r As Integer = 1 To Sheet.Rows.Count - 1 Dim Filter1 As String = "" For c As Integer = 0 To Sheet.Cols.Count - 1 If c > 0 Then Filter1 = Filter1 & " And " End If If sheet(r,c).Value <> "" AndAlso CurrentTable.DataTable.DataCols(sheet(0,c).Value).IsNumeric Then Filter1 = Filter1 & sheet(0,c).Value & " = " & sheet(r,c).Value ElseIf sheet(r,c).Value = "" Then Filter1 = Filter1 & sheet(0,c).Value & " is null " Else Filter1 = Filter1 & sheet(0,c).Value & " = \'" & sheet(r,c).Value & "\'" End If Next If CurrentTable.DataTable.Find(Filter1) Is Nothing Then Dim dr As Row = CurrentTable.AddNew() For c As Integer = 0 To Sheet.Cols.Count - 1 dr(Sheet(0,c).Value) = Sheet(r,c).Value Next End If Next DataTables("应收明细").ReplaceFor("年月", ny ,"[年月] is null") \'数据格式化 Dim t As Table = Tables("应收明细") Dim s As String For Each dc As DataCol In t.DataTable.DataCols If dc.name <> "年月" AndAlso dc.name <> "单位" AndAlso dc.name <> "ny1" Then s = "0.00" t.DataTable.DataCols(dc.Name).SetFormat(s) End If Next For Each dr As DataRow In DataTables("应收明细").DataRows If dr.IsNull("年月") Then dr("ny1") = Nothing Else dr("ny1") = Cdate(dr("年月")) End If Next DataTables("应收明细").DataCols("警务区").RaiseDataColChanged() Tables("应收明细").Sort = "年月,单位" Tables("应收明细").AutoSizeCols() Tables("应收明细").ListMode = True DataTables("应收明细").Save() Tables("应收明细").ResumeRedraw() Forms("加载提示").Close() Return End If Next Forms("加载提示").Close() Messagebox.show("需导入的数据不存在!","提示") |
-- 作者:yyzlxc -- 发布时间:2012/12/4 13:45:00 -- 改变单元格被锁住,还有哪些可能,请指教,谢谢!! |
-- 作者:lin_hailun -- 发布时间:2012/12/4 13:56:00 -- 远程,我帮你看一下是什么问题……联系客服QQ说找小林。 [此贴子已经被作者于2012-12-4 13:56:08编辑过]
|
-- 作者:yyzlxc -- 发布时间:2012/12/7 10:39:00 -- 在lin_hailun老师的热心帮助下,该问题得到圆满解决。方法是将加载表按钮的一段格式化代码 For Each dc As DataCol In t.DataTable.DataCols If dc.name
<> "年月" AndAlso dc.name <> "单位" AndAlso
dc.name <>
"ny1" Then s =
"0.00"
t.DataTable.DataCols(dc.Name).SetFormat(s) End If Next 替换为 For Each dc As DataCol In t.DataTable.DataCols If dc.IsNumeric Then s = "0.00" t.DataTable.DataCols(dc.Name).SetFormat(s) End If Next 在这里再次感谢lin_hailun老师的热心帮助。 |