Solved

Send Wscript.echo to a text box.

Posted on 2003-10-21
1
1,704 Views
Last Modified: 2013-12-26
Hi all, I have wrote a script which poll's a remote machine for information. Let's use the following example a test case scenario.

On Error Resume Next
strComputer = "Machinexxx"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Product",,48)
For Each objItem in colItems

    Wscript.Echo "Caption: " & objItem.Caption

Next

The problem I am having is that i want to output the result of the Wscript.Echo "Caption: " & objItem.Caption to a text box, so instead i used the following code.

 text1 = objItem.Caption & vbCrLf

Ok great, this now displays the result in the text box. The problem is that the argument may return lots of results, but only the last result is displayed in the text box, hence none of the previous results are displayed.

I have tried setting the text box property to "MultiLine" but still no joy, please help as i'm pulling my hair out.

Cheers,
Ribuck.
0
Comment
Question by:ribuck
1 Comment
 
LVL 44

Accepted Solution

by:
bruintje earned 500 total points
ID: 9590498
try

text1 = text1.Text & objItem.Caption & vbCrLf

hope this helps a bit
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now