回复 28# netegg
输入结束?
点击左列表,右边显示相应内容,这个通过下面的函数实现:Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Case 左击
du($tabname)
Func du($tabname)
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$RS = ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.Open("Select " & $T & " From " & $tabmain & " where name = '" & $tabname & "'")
$temp = StringStripWS($RS.Fields(2).value, 2) ;删去字符串中的所有"空白符" 1 char,2 char,3 int,4 char
$arr = StringSplit($temp, ",") ;以指定分隔符把字符串拆分成若干子串
$w = $arr[0]
GUICtrlDelete($ListView1)
Dim $k,$s ='',$c
For $c = 0 To $w-1
$y = StringSplit($arr[$c+1], " ")
$k = $k & $y[1] & ","
$s =$s & $y[1] & "|"
Next
$ListView1 = GUICtrlCreateListView("id|"&$s&"", 155, 15, 635, 300 )
$s=""
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$RS = ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.Open("Select " & $T & " From " & $tabname)
Dim $n
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
For $i = 0 To $w
;MsgBox(0,"",StringStripWS($RS.Fields ($i).value,2))
$n = $n & StringStripWS($RS.Fields($i).value, 2) & "|"
Next
;MsgBox(0,"",StringTrimRight ($n, 1))
GUICtrlCreateListViewItem(StringTrimRight($n, 1), $ListView1)
$RS.movenext
$n = ""
WEnd
$RS.close
$addfld.Close
;GUICtrlSetData($Label7, "共找到" & $i & "个和 " & GUICtrlRead($Input1) & " 相关的记录,点击车次可查看详细信息,双击查看该车次过站情况")
EndFunc
其中$s是字段a|b|c|d|.................... |