The problem I am having is I am requesting a WMI query in VB 6 for Modem Names & Ports
I have a FOR EACH LOOP, and there is more than 1 value for each (2 Ports show, so I have 2 values for each). How can I assign a variable so I can assign it to a Label or TextBox?
I would like a VB 6 code sample of how to assign a variable through the loop and how to call the variable?
This is my code (when I use MsgBox I can see it, it just pops up twice separately, but I want variables so I can assign them)
For Each objItem In colItems
MsgBox ("Test -" & objItem.Name)
Next
I tried this, and I get a number, but I don't know how to reference it
For Each objItem In colItems
Dim myCount
myCount = myCount + 1
Debug.Print objItem.Name & myCount '** i just tested with Debug.Print
Next
Form1.TextBox1.Text = myCount(1) '** THIS DOES NOT WORK
Form1.TextBox2.Text = myCount(2)
How Can I assign objItem.Name (it brings back 2 different objects)? This is what I get:
1SAMSUNG Mobile Modem #2
2SAMSUNG Mobile Modem Diagnostic Serial Port (WDM) (COM1)
(the 1 & 2 are from myCount)
Without using myCount, I just want to assign each value its own variable.