以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]逻辑列的一个问题? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=51726) |
||||
-- 作者:jk362223 -- 发布时间:2014/6/2 8:49:00 -- [求助]逻辑列的一个问题? 上传示例,有表“实验室检查”,有二列“已申请”,"已完成",为排他性逻辑列。有窗口名“ 实验室检查 ”,有字符列 “已申请”,"已完成"。现在的问题是:在表 DataColChanging中设代码: Select Case e.DataCol.Name Case "已申请","已完成" If e.NewValue = True Then Dim nms() As String = {"已申请","已完成"} For Each nm As String In nms If nm <> e.DataCol.Name AndAlso e.DataRow(nm) = True Then e.DataRow(nm) = False End If Next End If End Select 表“实验室检查”可实现排他性,而在窗口中的字符列 “已申请”,"已完成",不具有排他性选择。不知为何?
|
||||
-- 作者:y2287958 -- 发布时间:2014/6/2 9:46:00 -- 在DataColChanged中设置以下代码,试试。 Select Case e.DataCol.Name Case "已申请","已完成" If e.NewValue = True Then Dim nms() As String = {"已申请","已完成"} For Each nm As String In nms If nm <> e.DataCol.Name AndAlso e.DataRow(e.DataCol) = True Then e.DataRow(nm) = False End If Next End If End Select |
||||
-- 作者:jk362223 -- 发布时间:2014/6/2 15:41:00 --
示例,窗口1中有"ComboBox1"和"ComboBox2"和"Button17",给 "ComboBox1"和"ComboBox2"的AfterLoad设置 Dim cmd1 As New SQLCommand Dim dt1 As DataTable Dim cmb1 As WinForm.ComboBox cmd1.CommandText = "SELECT DISTINCT 姓名 From {基本资料}" dt1 = cmd1.ExecuteReader() cmb1 = e.Form.Controls("ComboBox2") cmb1.ComboList= dt1.GetComboListString("姓名") Dim cmd2 As New SQLCommand Dim dt2 As DataTable Dim cmb2 As WinForm.ComboBox cmd2.CommandText = "SELECT DISTINCT 标识 From {基本资料}" dt2 = cmd2.ExecuteReader() cmb2 = e.Form.Controls("ComboBox1") cmb2.ComboList= dt2.GetComboListString("标识") "Button17"的Click设置 Dim Filter As String With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then Filter = "标识 = \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "姓名 = \'" & .Value & "\'" End If End With DataTables("基本资料").LoadFilter = filter DataTables("基本资料").Load |
||||
-- 作者:有点甜 -- 发布时间:2014/6/3 15:28:00 -- 看了一下,你需要把ComboBox1的属性设置一下,清除它的【列表项目】设置 [此贴子已经被作者于2014-6-3 16:12:10编辑过]
|