ipmitool 发表于 2016-9-5 14:24:51

[已解决]請問 list view 要如何抓取同一列 Halt 字串有幾個?

本帖最后由 ipmitool 于 2016-9-7 15:00 编辑



請問 list view 要如何抓取同一列 Halt 字串有幾個?

nmgwddj 发表于 2016-9-5 14:33:44

这好像没什么便捷的方法,遍历、对比,不知道其他人有什么见解。

heroxianf 发表于 2016-9-5 14:58:06

我也只能使用楼上的办法。

kk_lee69 发表于 2016-9-5 18:02:55

回复 2# nmgwddj

這是資料庫的工作利用簡單的資料庫 計算後 可得到結果

ipmitool 发表于 2016-9-7 08:08:32

回复 4# kk_lee69


    可是我的程式, 每10分鐘會update 一次 ListView, 如果每10分鐘就同步一次資料庫, 會不會太耗費記憶體呢? Thanks

kk_lee69 发表于 2016-9-7 10:47:35

回复 5# ipmitool

不會啦 你不一定要用甚麼資料庫   MDB 也是資料庫
可以自己弄自己小型的資料庫就好

只是 你可以使用SQL 語法 做資料庫的計算工作而已

kk_lee69 发表于 2016-9-7 10:48:54

回复 5# ipmitool

不會啦 你不一定要用甚麼資料庫   MDB 也是資料庫
可以自己弄自己小型的資料庫就好

只是 你可以使用SQL 語法 做資料庫的計算工作而已

陣列(數組) 要做搜尋 比對   是麻煩多了

如果是簡單的比對那倒也不一定用資料庫   可以 直接用數組 做比對

ipmitool 发表于 2016-9-7 11:14:25

回复 7# kk_lee69


    那假設不用資料庫, 以下語法要怎麼改啊...?#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $iI, $idListview

    GUICreate("ListView Find In Text", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_InsertColumn($idListview, 0, "Items", 100)

    ; Add items
    _GUICtrlListView_BeginUpdate($idListview)

    _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")
    _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")
        _GUICtrlListView_AddItem($idListview, "On-going")
        _GUICtrlListView_AddItem($idListview, "Halt")

    _GUICtrlListView_EndUpdate($idListview)

    ; Search for target item

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

kk_lee69 发表于 2016-9-7 11:44:39

回复 8# ipmitool

LIST VIEW 本身是無法做判斷的你得將內容放到數組 裡面

再由 數組跑回圈才能判斷.....

方法一用你現在會的方法把 資料 再放到數組裡面   

方法二   用 虛擬 LISTVIE數組本身的內容就是 LIST VIEW更新了數組LISTVIE 就更新了

所以 本身就存在 數組你就從數組 去做排序 跟搜尋即可

http://www.autoitx.com/forum.php?mod=viewthread&tid=34526&highlight=%D0%E9%C4%E2
http://www.autoitx.com/thread-50083-1-1.html

這兩篇文章 看看   學會了 對於 你幫助很大虛擬的比較好用 速度快

kk_lee69 发表于 2016-9-7 12:07:57

回复 8# ipmitool

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $iI, $idListview
       
        DIM $ARRAY
        $ARRAY="Halt"
        $ARRAY="On-going"
        $ARRAY="Halt"
        $ARRAY="Halt"
        $ARRAY="On-going"
        $ARRAY="Halt"
        $ARRAY="Halt"
        $ARRAY="On-going"
        $ARRAY="Halt"
        $ARRAY="On-going"
        $ARRAY="Halt"

    GUICreate("ListView Find In Text", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_InsertColumn($idListview, 0, "Items", 100)
       
    ; Add items
    _GUICtrlListView_BeginUpdate($idListview)
    FOR $i=0 TO 10


    _GUICtrlListView_AddItem($idListview,$ARRAY[$i])


        Next
       
    _GUICtrlListView_EndUpdate($idListview)

    ; Search for target item
       
        $a=0
       
    FOR $i=0 TO 10


    If $ARRAY[$i]="Halt" THEN $a=$a+1


        Next

        MsgBox(0,"","Halt 一共 "&$a&" 個")



    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example
页: [1]
查看完整版本: [已解决]請問 list view 要如何抓取同一列 Halt 字串有幾個?