找回密码
 加入
搜索
查看: 1982|回复: 7

怎样才能将变量的值输出到ListView控件里呢,ListViewItem()无法调用变量。

  [复制链接]
发表于 2009-8-19 15:55:48 | 显示全部楼层 |阅读模式
本帖最后由 figons 于 2009-8-19 16:51 编辑

Global $hostnum = "na98263215",$mac = "45b6d722",$status = "正在测试" ,$servernum = "bjl1s101"

$listView = GuiCtrlCreateListView("主机名     |MAC地址    |测试状态  |服务器  ", 20, 200, 380, 80)
GuiCtrlCreateListViewItem($hostnum|$mac|$status|$servernum, $listView)

如上代码,GuiCtrlCreateListViewItem()无法调用变量,用什么方法可以把上面4个变量的值在GuiCtrlCreateListViewItem()里显示呢。

请高手支招。谢谢了。
发表于 2009-8-19 16:31:07 | 显示全部楼层
本帖最后由 afan 于 2009-8-19 16:39 编辑
GuiCtrlCreateListViewItem($hostnum & '|' & $mac & '|' & $status & '|' & $servernum, $listView)
或者
$id1 = GUICtrlCreateListViewItem ( "|||", $listView )
GUICtrlSetData ( $id1, $hostnum & '|' & $mac & '|' & $status & '|' & $servernum)
这样行不行?
 楼主| 发表于 2009-8-19 16:51:05 | 显示全部楼层
经验证,第一种方法无效,用第二种方法成功搞定。
谢谢afan。
发表于 2011-5-18 00:22:40 | 显示全部楼层
本帖最后由 annybaby 于 2011-5-18 00:24 编辑

回复 3# figons

经验证,A大的第一种方法也完全可以~~
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $hostnum = "na98263215",$mac = "45b6d722",$status = "正在测试" ,$servernum = "bjl1s101"
$Form1 = GUICreate("Form1", 500,200, 192, 124)
$listView = GuiCtrlCreateListView("主机名     |MAC地址    |测试状态  |服务器  ",16, 72, 457, 97)
GuiCtrlCreateListViewItem($hostnum&'|'&$mac&'|'&$status&'|'&$servernum, $listView)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

本帖子中包含更多资源

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

×
发表于 2011-5-18 00:27:29 | 显示全部楼层
回复 3# figons


    你原来的方法就可以,只是
GuiCtrlCreateListViewItem($hostnum|$mac|$status|$servernum, $listView)
里面少了连接符 &
发表于 2011-5-18 07:16:04 | 显示全部楼层
恩不错!!!!要了!
 楼主| 发表于 2011-12-2 10:17:11 | 显示全部楼层
嗯,不错,谢谢指点。
发表于 2012-7-13 10:08:43 | 显示全部楼层
谢谢,既然很有用还是回复一下比较好。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-30 05:32 , Processed in 0.082629 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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