以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- VBA文本框取值问题 (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=54353) |
-- 作者:macro -- 发布时间:2013/7/26 16:36:27 -- VBA文本框取值问题 Set Report1 = marketdata.GetReportData("IF08","ZJ")
currentPrice = Report1.NewPrice \'现在最新价是2192
price = CATraderUI_priceTextBox.value
if (currentPrice >= price) then msgbox ">="
else
msgbox "<"
end if
\'无论在文本框中输入任何数,最后均出现 "<" 提示!不知问题出在哪儿了?
但如果我改写成
... if (currentPrice >= 2000) then
msgbox ">="
else
msgbox "<"
end if
最后出现正确的提示 ">="
CATraderUI_priceTextBox文本框取值.Text取出来是String,.value取出来的Variant数据类型,它均不能与Report1.NewPrice直接比较大小吗?
切盼回复,谢谢! |
-- 作者:王锋 -- 发布时间:2013/7/26 16:50:47 -- price = CDbl(CATraderUI_priceTextBox.value)
强制转换一下文本框的文本为数字后再试试
|
-- 作者:macro -- 发布时间:2013/7/26 16:58:09 -- 果然OK了!万分感激! |