以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- CurrentTable 替换成窗口所有者表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=116988) |
-- 作者:yifan3429 -- 发布时间:2018/4/3 21:58:00 -- CurrentTable 替换成窗口所有者表 下面的代码是针对当前显示表的 我想换成窗口所有者表 If e.sender.Text.Contains("[") OrElse e.sender.Text.Contains("\'") OrElse e.sender.Text.Contains("*") OrElse e.sender.Text = "回车查询筛选树" Then Return End If Dim Values As New List (Of String) Dim fltstr() As String Dim txt As String = e.sender.Text Dim flt As String For Each c As Col In CurrentTable.Cols If c.DataCol.IsString AndAlso c.Name <> "拼音" Then Values.Add(c.Name) End If Next If Values.Count = 0 Then Return End If txt = txt.Trim() If txt = "" Then flt = "" Else If txt.Contains(",") Then fltstr = txt.split(",") Dim i As Integer = InStrRev(txt,",") Dim py As String = txt.SubString(i) py = "\'*" & py & "*\'" For Int As Integer = 0 To Values.Count - 1 If CurrentTable.Cols(Values(Int)).DataCol.IsString = False Then Continue For End If For Index As Integer = 0 To fltstr.Length - 1 If Int = Index Then flt = flt & Values(Int) & " Like \'*" & fltstr(Index) & "*\'" & " And " Else Continue For End If Next Next flt = Left(flt,flt.Length - 5) If CurrentTable.Cols.Contains("拼音") Then flt = flt & " Or 拼音 Like " & py End If Else txt = "\'*" & txt & "*\'" For Int As Integer = 0 To Values.Count - 1 If CurrentTable.Cols(Values(Int)).DataCol.IsString = False Then Continue For End If flt = flt & Values(Int) & " Like " & txt & " Or " Next flt = Left(flt,flt.Length - 4) If CurrentTable.Cols.Contains("拼音") Then flt = flt & " Or 拼音 Like " & txt End If End If End If CurrentTable.Filter = flt If e.KeyCode = Keys.Enter Then If e.sender.Text.Contains("[") OrElse e.sender.Text.Contains("\'") OrElse e.sender.Text.Contains("*") OrElse e.sender.Text = "回车查询选择列" Then Return End If Dim s As String = e.Form.Controls("CheckedComboBox选择列").Text If s = "" OrElse s = "选择筛选列(最好包括拼音)" Then Return End If Dim Colstr() As String Colstr = s.split("|") Dim t As Table = CurrentTable Dim r As Row Dim c As String Dim txt As String = e.sender.Text Dim flt As String Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") Dim havestr As Integer = 0 For i As Integer = 0 To Colstr.Length - 1 If CurrentTable.Cols.Contains(Colstr(i)) = False Then If trv.Nodes.Count > 0 Then trv.Nodes.Clear() End If e.Form.Controls("CheckedComboBox选择列").Text = "选择筛选列(最好包括拼音)" Return End If Next For Each c In Colstr If t.Cols(c).DataCol.IsString Then havestr + = 1 End If Next If havestr = 0 Then Return End If For Each r In t.Rows For Each c In Colstr If r.IsNull(c) Then If t.Cols(c).DataCol.IsDate Then r(c) = #01/01/0001# ElseIf t.Cols(c).DataCol.IsNumeric Then r(c) = 0 ElseIf t.Cols(c).DataCol.IsBoolean r(c) = False Else r(c) = "空" End If End If Next Next txt = txt.Trim() If txt = "" Then flt = "" Else txt = "\'*" & txt & "*\'" For i As Integer = 0 To Colstr.Length - 1 If t.Cols(Colstr(i)).DataCol.IsString = False Then Continue For End If flt = flt & Colstr(i) & " Like " & txt & " Or " Next If s.Contains("拼音") Then flt = flt & " 拼音 Like " & txt Else flt = Left(flt,flt.Length - 4) End If End If trv.StopRedraw() trv.Nodes.Clear() trv.BuildTree(t.DataTable.Name,s,flt) trv.ResumeRedraw() If trv.AllNodes.Count > 0 Then trv.Nodes.Insert("显示所有行",0) End If trv.Select() If t.DataTable.Type = 5 Then For Each r In t.Rows For Each c In Colstr If t.Cols(c).DataCol.IsDate Then If r(c) = #01/01/0001# r(c) = Nothing End If ElseIf t.Cols(c).DataCol.IsNumeric Then If r(c) = 0 Then r(c) = Nothing End If ElseIf t.Cols(c).DataCol.IsBoolean Then If r(c) = False Then r(c) = Nothing End If Else If r(c) = "空" Then r(c) = Nothing End If End If Next Next Else t.DataTable.RejectChanges() End If End If
|
-- 作者:有点蓝 -- 发布时间:2018/4/3 22:40:00 -- http://www.foxtable.com/webhelp/scr/0707.htm CurrentTable改为tables(e.form.TableName )
|