找回密码
 加入
搜索
查看: 1727|回复: 3

GUICtrlCreateTreeView问题 读取重复 帮我看看 不胜感激

[复制链接]
发表于 2008-8-15 02:21:31 | 显示全部楼层 |阅读模式
#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
$mdb_data_pwd = "112233"
$Form1 = GUICreate("Form1", 204, 404, 193, 115)
$TreeView1 = GUICtrlCreateTreeView(40, 40, 121, 305)
$TreeView1_0 = GUICtrlCreateTreeViewItem("服务端游戏", $TreeView1)
$TreeView2_0 = GUICtrlCreateTreeViewItem("客户端游戏", $TreeView1)
$Button1 = GUICtrlCreateButton("Button1", 56, 368, 75, 25, 0)
GUISetState(@SW_SHOW)


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case        $Button1
                        _idclass1du($TreeView1_0,$TreeView1)
        EndSwitch
WEnd

Func _idclass1du($TreeView1_0,$TreeView1)
        GUICtrlSendMsg($TreeView1, $LVM_DELETEALLITEMS, 0, 0)
        FileDelete(@ScriptDir & "\data\temp.dll")
        $addfld = ObjCreate("ADODB.Connection")
        $addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & @ScriptDir & "\data.mdb" & ";Jet Oledb:Database Password=" & $mdb_data_pwd)
        $RS = ObjCreate("ADODB.Recordset")
        $RS.ActiveConnection = $addfld
        $RS.Open("Select * From  class")
        While Not $RS.eof And Not $RS.bof
                If @error = 1 Then ExitLoop
                $who1 = $RS.Fields(0).value
                $who2 = $RS.Fields(1).value
                $sintg1 = StringStripWS($who1, 8)
                $sintg2 = StringStripWS($who2, 8)
                IniWrite(@ScriptDir & "\data\temp.dll", "log", $sintg2, $sintg1)
                GUICtrlCreateTreeViewItem($sintg2, $TreeView1_0)
                GUICtrlCreateTreeViewItem($sintg2, $TreeView2_0)
                $RS.movenext
        WEnd
        $RS.close
        $addfld.Close
EndFunc  


点按钮一次读一下 可以读出来 但是点一次以前的并没有消失  而是重复的读取出来了  很郁闷
附件为我的数据库和代码

[ 本帖最后由 kryiran 于 2008-8-21 10:15 编辑 ]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-8-15 07:41:14 | 显示全部楼层
先清除列表数据,再重新读取写入列表即可。跟ListView的一样的。
 楼主| 发表于 2008-8-15 08:56:01 | 显示全部楼层

已经清过了啊

但是不管用哈
发表于 2008-8-15 09:11:58 | 显示全部楼层
_GUICtrlTreeView_Delete
_GUICtrlTreeView_DeleteAll
_GUICtrlTreeView_DeleteChildren
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-23 14:18 , Processed in 0.075919 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表