使用循环刷新文本框 [英] Refresh textbox using a loop

查看:82
本文介绍了使用循环刷新文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,



我有一个很长的vb脚本,它循环通过IP并收集WMI数据。我需要在文本框中查看每个IP的结果,只是成功或失败。



我已将文本框放在updatePanel中,添加了scriptManager并进行了测试它带有一个按钮,所以我知道它有效,但我不能让它在循环中触发。



我不打算发布整个脚本但是这是它的结束...



否则

autoResults = autoResults&cIP&NOT FOUND&Environment.NewLine
结束如果

TBdata.Text = autoResults

UpdatePanel1.Update()

结束如果

Loop Until index> IPs



任何帮助将不胜感激... Lee

Hey all,

I've got a long vb script which loops through IP's and collects WMI data. I need to see the results of each IP, just success or fail, in a textbox.

I've placed the textbox inside a updatePanel, added the scriptManager and tested it with a button so I know it works, but I can't get it to fire inside the loop.

I'm not going to post the entire script but here's the end of it...

Else
autoResults = autoResults & cIP & " NOT FOUND" & Environment.NewLine
End If
TBdata.Text = autoResults
UpdatePanel1.Update()
End If
Loop Until index > IPs

any help will be appreciated... Lee

推荐答案

你不能在循环中做任何事情除非你真的写了一个循环。请参阅:

https://msdn.microsoft.com/en-us /library/ezk76t25.aspx [ ^ ],

https://msdn.microsoft.com/en -us / library / eked04a7.aspx [ ^ ],

http://en.wikibooks.org/wiki /Visual_Basic_.NET/Loop_statements [ ^ ]。



也不是说你不能在循环中为某些 Text 属性分配一些字符串,因为下一循环迭代将丢弃在前一次迭代中分配的字符串。所以,你需要连接字符串到循环之前初始化的字符串。



如何停止做你正在做的事情和阅读教科书语言和.NET到底是什么?



-SA
You cannot do anything in a loop unless you actually write a loop. Please see:
https://msdn.microsoft.com/en-us/library/ezk76t25.aspx[^],
https://msdn.microsoft.com/en-us/library/eked04a7.aspx[^],
http://en.wikibooks.org/wiki/Visual_Basic_.NET/Loop_statements[^].

Also not that you cannot just assign some string to some Text property in a loop, because next loop iteration will discard the string assigned on the previous iteration. So, you need to concatenate strings to some string initialized before loop.

How about stopping doing what you are doing and reading a textbook on the language and .NET to the very end?

—SA


这篇关于使用循环刷新文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆