Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 8-Feb-15 11:01am
v3

1 solution

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
 
Share this answer
 
Comments
BikerMonkey 6-Feb-15 22:10pm    
SA,
Did you note that I was not posting the entire script? Your comments are unhelpful... Have a great day
Sergey Alexandrovich Kryukov 6-Feb-15 23:15pm    
Well, just a bad question. Nothing can be helpful to you except taking a textbook and not being so lazy.
Thank you.
—SA
BikerMonkey 8-Feb-15 12:45pm    
SA,

Let me see if I understand your reply correctly.... Refreshing a textbox with WMI data that is being obtained in a loop and being displayed in realtime using an updatePanel is so trivial that I should not have asked the question?

I also need to clarify that you did read my question and understand that I'm not asking how to create a loop or obtain and manipulate the data and you did note that I only included the very end of a very long script?

Now if all that is true and getting the textbox contained in an updatePanel to display the WMI results of each IP as it loops through the IPs is trivial I'm very happy to hear it, but I've been searching the literature for days now and I haven't found the answer I need. So knowing the very smart, courteous and helpful people here I thought I might get some help.
Sergey Alexandrovich Kryukov 8-Feb-15 14:42pm    
Let's interrupt it at the first point: nothing is "displayed in real time". This is not a real time system. What do you really mean? No, your questions are welcome. Yes, you did not ask how to create a loop, but it's just your question gives me the strong impression you don't know how to do it. Sorry if it was my mistake, but you need to be more clear in your formulation. Please start over and use "Improve question". Your code sample should be comprehensive, and so on. It's better not to pretend that someone did not read your question, but make sure it's readable.
—SA
BikerMonkey 8-Feb-15 16:56pm    
Your apology is accepted.

What I mean by realtime is indicated by the snippet of code I posted. I'll try to make it more clear... The results (success or failure) of "each iteration" of the loop should be shown in the text box "while" the loop is running. This may not be possible since it probably is going require multiple processes to run simultaneously, but hey what do I know?

Thank you for pointing out the "improve question" button, that "is" helpful as is the pointers about how to answer a question right below the "submit your solution" button... I'm not going to pretend or assume you've never seen them.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900