snufse
Aug 14th, 2007, 11:46 AM
I trying to retrieve IPCONFIG data into a ListBox using vb.net. The only code I have found that will do that is as per below. However, the code does not work. Is there a good way to do this?
Dim i As Integer
Dim Shell = CreateObject("Wscript.Shell")
Shell.run("cmd /c ipconfig /all >> C:\ipconfig.txt")
Dim sr As New IO.StreamReader("C:\ipconfig.txt")
Dim s As String = sr.ReadToEnd
For i = 0 To sr.ReadToEnd.LastIndexOf(i)
ListBox1.Items.Add(s(i).ToString)
Next
Dim i As Integer
Dim Shell = CreateObject("Wscript.Shell")
Shell.run("cmd /c ipconfig /all >> C:\ipconfig.txt")
Dim sr As New IO.StreamReader("C:\ipconfig.txt")
Dim s As String = sr.ReadToEnd
For i = 0 To sr.ReadToEnd.LastIndexOf(i)
ListBox1.Items.Add(s(i).ToString)
Next