Hi,
Please tell me the code for getting IP address of a current system in VB6.
Thanx
Ravi Prakash
Please tell me the code for getting IP address of a current system in VB6.
Thanx
Ravi Prakash
Imports System
Imports System.Management
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_NetworkAdapterConfiguration")
Dim ListNetCards As ManagementObjectCollection
Dim ipadds As Array
ListNetCards = searcher.Get()
For Each Netcard In ListNetCards
For Each prop In Netcard.Properties
If Not prop.Value Is Nothing Then
Select Case UCase(prop.Name)
Case "IPADDRESS"
ipadds = prop.Value
For Each ipadd In ipadds
ListBox1.Items.Add("IP Address : " & ipadd.ToString)
Next
Case "DESCRIPTION"
ListBox1.Items.Add("Description : " & prop.Value.ToString)
Case "DHCPENABLED"
ListBox1.Items.Add("DHCP Enabled : " & prop.Value.ToString)
Case "CAPTION"
ListBox1.Items.Add("Caption : " & prop.Value.ToString)
End Select
End If
Next
ListBox1.Items.Add("")
ListBox1.Items.Add("*******")
ListBox1.Items.Add("")
Next
End Sub
End Class
msgbox winsock1.LocalIP
Comment