Hi Everyone,
I need your help with breaking out data within an array. The below code is a WMI query on your local machine that should output your IP addresses via a message box.
My problem is that when I run the code, the message box displays "System.String[]". I know this is because machines may have multiple IPs and they stored in this array.
My question is, how do I output the data within this array? ANY help would be greatly appreciated.
Here is a link from Microsoft outlining the IPAddress aray http://msdn2.microsoft.com/en-us/library/aa394217.aspx
Code:Imports System.Management Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim manScope As ManagementScope Dim manPath As ManagementPath Dim manClass As ManagementClass Dim manObj As ManagementObject Dim manObjCol As ManagementObjectCollection Dim output As String = String.Empty Dim RemoteMachineName As String RemoteMachineName = "." Try manPath = New ManagementPath("\\" & RemoteMachineName & "\root\CIMV2:Win32_NetworkAdapterConfiguration") manScope = New ManagementScope(manPath) manClass = New ManagementClass(manScope, manPath, Nothing) manObjCol = manClass.GetInstances() For Each manObj In manObjCol MsgBox(manObj("IPAddress").ToString) Next Catch ex As Exception ' MessageBox.Show(ex.Message) Finally manPath = Nothing manScope = Nothing manClass = Nothing manObjCol = Nothing End Try End Sub End Class




Reply With Quote