Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
直接从菜单删除这个按钮
直接从菜单删除这个按钮
这个我知道,但是这个重置列的菜单我要留着,我想是这样的,我有一张表中的某一列不允许刷新.
那就自己设计重置按钮的代码,判断选定的表和列,符合要求再重置。
if currenttable.Name = "xxx" AndAlso CurrentTable.Cols(CurrentTable.Colsel).Name = "yyy"
'不重置
Else
'重置
End If
那就自己设计重置按钮的代码,判断选定的表和列,符合要求再重置。
if currenttable.Name = "xxx" AndAlso CurrentTable.Cols(CurrentTable.Colsel).Name = "yyy"
'不重置
Else
'重置
End If
一个,这个也放入菜单中吗?第二,不重置的代码怎么写?
是的,放入菜单中替换原来的重置按钮大拿。
不重置的代码是不需要写的,你喜欢的话,可以: Messagebox.Show("此列不能重置")
或者:
If e.DataCol.Name = "开始箱号" Orelse e.DataCol.Name = "箱数" Then
If e.DataRow.IsNull("开始箱号") = False Andalso e.DataRow.IsNull("箱数") = False Then
e.DataRow("结束箱号") = e.DataRow("开始箱号") +e.DataRow("箱数") -1
End If
End If
If e.DataCol.Name = "口岸" Orelse e.DataCol.Name = "箱数" Then
If e.DataRow.IsNull("口岸") = False Andalso e.DataRow.IsNull("箱数") = False Then
Dim dr As DataRow = DataTables("装箱单").Find("[IO] = '" & e.DataRow("IO") & "' And [口岸] = '" & e.DataRow("口岸") & "' And [结束箱号] > 0","_identify Desc")
If dr IsNot Nothing Then
e.DataRow("开始箱号") = dr("结束箱号")+1
Else
e.DataRow("开始箱号") = 1
End If
End If
End If
这一段代码,我一但刷新"箱数"列后,会重新再加一遍,而且"开始箱号"和"结束箱号"不再是连续箱号了.有没有什么代码可以将"箱数"列刷新后,开始箱号和结束箱号,自动按照连续箱号再计算一遍.
只要有确定的逻辑关系,都可以用代码表示出来。
但商业逻辑上的问题,别人很难看懂的。
我只觉得,上面两段代码应该换一下位置:
If e.DataCol.Name = "口岸" Then
If e.DataRow.IsNull("口岸") = False Andalso e.DataRow.IsNull("箱数") = False Then
Dim dr As DataRow = DataTables("装箱单").Find("[IO] = '" & e.DataRow("IO") & "' And [口岸] = '" & e.DataRow("口岸") & "' And [结束箱号] > 0","_identify Desc")
If dr IsNot Nothing Then
e.DataRow("开始箱号") = dr("结束箱号")+1
Else
e.DataRow("开始箱号") = 1
End If
End If
End If
If e.DataCol.Name = "开始箱号" Orelse e.DataCol.Name = "箱数" Then
If e.DataRow.IsNull("开始箱号") = False Andalso e.DataRow.IsNull("箱数") = False Then
e.DataRow("结束箱号") = e.DataRow("开始箱号") +e.DataRow("箱数") -1
End If
End If
狐爸,我测试过,你这个代码和我的原代码没有什么区别.
我贴两张图上来一张是刷新前:
一张刷新后:
我的意思箱数刷新以后,如果开始箱号和结束箱号的连续性是对的,那么不做反应,如果连续性不对,则按照刷新前图片一样的连续性自动修正!
蒙一下:
If e.DataCol.Name = "口岸" Then
If e.DataRow.IsNull("口岸") = False Then
Dim dr As DataRow = DataTables("装箱单").Find("[IO] = '" & e.DataRow("IO") & "' And [口岸] = '" & e.DataRow("口岸") & "' And [结束箱号] > 0","_identify Desc")
If dr IsNot Nothing Then
e.DataRow("开始箱号") = dr("结束箱号")+1
Else
e.DataRow("开始箱号") = 1
End If
End If
End If
If e.DataCol.Name = "开始箱号" Orelse e.DataCol.Name = "箱数" Then
If e.DataRow.IsNull("开始箱号") = False Andalso e.DataRow.IsNull("箱数") = False Then
e.DataRow("结束箱号") = e.DataRow("开始箱号") +e.DataRow("箱数") -1
End If
End If