找回密码
 加入
搜索
查看: 1789|回复: 6

[AU3基础] [已解决]数字运算问题

  [复制链接]
发表于 2011-8-15 22:31:56 | 显示全部楼层 |阅读模式
本帖最后由 king8462 于 2011-8-16 13:57 编辑

从listview中获取字符串,然后使用StringSplit后无法正常运算,求解!
Func _del()
        $d = MsgBox(1 + 64, "提示", "是否删除选中项目?")
        If $d = 1 Then
               $key = _GUICtrlListView_GetItemTextString($ListView2)
                           
                           $key2 = StringSplit($key, '|', 1)
                           GUICtrlSetData($Inputdh,$key2[4])
                 MsgBox(0,"0",$key2[4])
                                 
                                $heji= GUICtrlRead($input11)
                                $key3=GUICtrlRead($inputdh)
                                
       

                        
                        $66=_GetNumber($key3)
                        
                                $heji2=$heji-$66
                                
                                                        
                                GUICtrlSetData($Input11,$heji2)
                                
                                
                _GUICtrlListView_DeleteItemsSelected($ListView2)
        ElseIf $d = 2 Then
                MsgBox(64, "", "你放弃删除选中项!")
        EndIf
        EndFunc   ;==>_del
发表于 2011-8-15 22:46:23 | 显示全部楼层
代码很隐秘吗?能否看看完整的呢?
发表于 2011-8-15 23:01:31 | 显示全部楼层
回复 2# 水木子


    万一你偷学了怎么办呢,哈哈……
发表于 2011-8-15 23:11:19 | 显示全部楼层
刚好找到个例子
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("数字运算问题", 382, 139, 214, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event")
$ListView1 = GUICtrlCreateListView("1 |2", 40, 24, 300, 89)
;GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100)
$ListView1_0 = GUICtrlCreateListViewItem("123 |456", $ListView1)
GUICtrlSetOnEvent($ListView1_0, "Event")
$ListView1_1 = GUICtrlCreateListViewItem("456 |789", $ListView1)
GUICtrlSetOnEvent(-1, "Event")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Sleep(100)
WEnd

Func Event()
        Switch @GUI_CtrlId
                Case $GUI_EVENT_CLOSE
                        Exit
                Case Else
                        $Val = GUICtrlRead(@GUI_CtrlId, 1)
                        $Val = StringSplit($Val, "|", 1)
                        MsgBox("", $Val[1], "相加结果:"&$Val[2]+$Val[1])
        EndSwitch
EndFunc   ;==>Event
 楼主| 发表于 2011-8-16 07:51:39 | 显示全部楼层
从listview中获取字符串,然后使用StringSplit后无法正常运算,求解!
king8462 发表于 2011-8-15 22:31



调用的是本地sql server 2000数据库!
发表于 2011-8-16 09:11:39 | 显示全部楼层
无其他代码的,谁愿意帮你!
叫人家帮你猜?
 楼主| 发表于 2011-8-16 13:56:40 | 显示全部楼层
晕,重新测试又可以计算了!

谢谢几位,打扰了!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-1 19:33 , Processed in 0.081887 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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