Click here to Skip to main content
13,355,311 members (55,812 online)
Click here to Skip to main content
Add your own
alternative version


83 bookmarked
Posted 19 Aug 2004

LAN Messenger

, 19 Aug 2004
Rate this:
Please Sign up or sign in to vote.
A tool for communicating with the computers across the network.

Sample Image - MyLanApp.jpg


This is a tool which is created using the Active Directory objects in VB.NET. Using this tool, we can communicate with the computers across the network.

Once the form is loaded, it will bring out all the computer names in a TreeView control. If you click on any computer name from the tree view, it will display the selected item in the right top textbox; it will show the computer name and also the IP address details below.

We have to type the message that we want to send, in the Message to Send box, and if you press the Send button, it will send the message to the selected computer.

In the same way, if we want to send messages to all the computers, if we press the Send to All button, it will send the message to all the computers; we also have a provision to ‘ping’ the selected node.

For sending messages to another computer, we have a ‘Net Send’ command; it is a DOS command. To run any executable program, we have a ‘Shell’ command.

Shell("net send " & txtcomputer.Text & " " & txtmessage.Text)

The above line is a part of the code which will send a message to a specified computer.

To Ping the another node, the following is the command:

Shell("PING " & TextBox1.Text)

In the ‘TextBox1’ we will have the IP address of the selected computer.

To get the IP Address of the computer using the tool, we have a generic function called “GetIPAddress”.

Function GetIPAddress(ByVal CompName As String) As String
Dim oAddr As System.Net.IPAddress
Dim sAddr As String
    With System.Net.Dns.GetHostByName(CompName)
oAddr = New System.Net.IPAddress(.AddressList(0).Address)
sAddr = oAddr.ToString
          End With
          GetIPAddress = sAddr
  Catch Excep As Exception
    MsgBox(Excep.Message, MsgBoxStyle.OKOnly, "Lan Messenger")
  End Try
End Function


Gets the DNS information for a specified DNS host name. Only we have to pass the ‘hostname’. Returns the host information for the address specified in hostName.


Provides an Internet Protocol (IP) address. The following is the code to list the computers in the network:

Dim childEntry As DirectoryEntry
Dim ParentEntry As New DirectoryEntry()
  ParentEntry.Path = "WinNT:"
  For Each childEntry In ParentEntry.Children
      Dim newNode As New TreeNode(childEntry.Name)
      Select Case childEntry.SchemaClassName
             Case "Domain"
             Dim ParentDomain As New TreeNode(childEntry.Name)
             TreeView1.Nodes.AddRange(New TreeNode() {ParentDomain})
             Dim SubChildEntry As DirectoryEntry
             Dim SubParentEntry As New DirectoryEntry()
             SubParentEntry.Path = "WinNT://" & childEntry.Name
             For Each SubChildEntry In SubParentEntry.Children
                 Dim newNode1 As New TreeNode(SubChildEntry.Name)
                 Select Case SubChildEntry.SchemaClassName
                        Case "Computer"
                 End Select
      End Select
  Catch Excep As Exception
        MsgBox("Error While Reading Directories")
       ParentEntry = Nothing
End Try


The .NET Framework System.DirectoryServices namespace is a robust and flexible API for querying and manipulating objects in Microsoft's Active Directory.

Active Directory is Microsoft's network operating system (NOS) directory, built on top of Windows 2000 and Windows Server 2003. It enables administrators to manage enterprise-wide information efficiently from a central repository that can be globally distributed.

The two main classes within System.DirectoryServices are DirectoryEntry and DirectorySearcher. The DirectoryEntry class represents an object in the directory, and can be used to create new objects and manage existing ones.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
Kuwait Kuwait
I am J. Franklin Kennedy, Working as a programmer in application software developement.

You may also be interested in...

Comments and Discussions

GeneralRe: Vista Pin
VF14-Oct-07 3:03
memberVF14-Oct-07 3:03 
GeneralReadme Pin
toon402820-May-07 23:52
membertoon402820-May-07 23:52 
GeneralHello Sir, Pin
praveen_b18-May-07 19:50
memberpraveen_b18-May-07 19:50 
GeneralNot shows the list of computers Pin
Rajkumar S. Rajput2-May-07 2:18
memberRajkumar S. Rajput2-May-07 2:18 
QuestionHow to receive message? Pin
testmail_12322-Feb-07 20:39
membertestmail_12322-Feb-07 20:39 
AnswerRe: How to receive message? Pin
vsuguna10-Oct-09 3:29
membervsuguna10-Oct-09 3:29 
GeneralDue to XP service pk2 this kind of messenger services has been disabled [modified] Pin
godsemporer13-Aug-06 14:52
membergodsemporer13-Aug-06 14:52 
Generalthank you Pin
jimbo_azim12-Jun-06 19:45
memberjimbo_azim12-Jun-06 19:45 
hi sir, eventhough ur app is not fully working.. but thanks coz i can use some the code to apply it in my studies. because i have to develop an app that is use to monitor the currently existing server in my practical industrial place.. thanks alot..

GeneralRe: thank you Pin
diasroyal8-Jul-11 5:35
memberdiasroyal8-Jul-11 5:35 
Generalthank you any way Pin
osamahamed12326-Feb-06 0:56
memberosamahamed12326-Feb-06 0:56 
GeneralShutup Pin
Mike K. Clark26-Jan-06 16:13
memberMike K. Clark26-Jan-06 16:13 
Generalnice appn but getting problem with net send Pin 22:06 22:06 
GeneralIf you've nothing contructive to say, move on Pin
Like2Byte19-Jul-05 9:18
memberLike2Byte19-Jul-05 9:18 
General[Message Deleted] Pin
sussPERREO PAPI PERREO9-Jul-05 14:03 
GeneralRe: it suks Pin
Colin Angus Mackay9-Jul-05 14:26
memberColin Angus Mackay9-Jul-05 14:26 
GeneralRe: it suks Pin
greg.boudreau16-Jul-07 5:22
membergreg.boudreau16-Jul-07 5:22 
Generalnice program Pin
KlaasjanMors14-Apr-05 12:08
memberKlaasjanMors14-Apr-05 12:08 
GeneralIt doesn't work Pin
Vinay K. Ladwal6-Jan-05 22:48
memberVinay K. Ladwal6-Jan-05 22:48 
Generalplcation.Doesn't work Pin
Vinay K. Ladwal6-Jan-05 22:46
memberVinay K. Ladwal6-Jan-05 22:46 
QuestionHow do i..... Pin
nalixx@hotmail.com12-Sep-04 21:49
membernalixx@hotmail.com12-Sep-04 21:49 
AnswerRe: How do i..... Pin
diasroyal8-Jul-11 6:30
memberdiasroyal8-Jul-11 6:30 
Anonymous20-Aug-04 11:49
sussAnonymous20-Aug-04 11:49 
Franklin Kennedy21-Aug-04 9:35
sussFranklin Kennedy21-Aug-04 9:35 
m a y s a m23-Aug-04 21:19
memberm a y s a m23-Aug-04 21:19 
SadButTrue25-Aug-04 2:49
sussSadButTrue25-Aug-04 2:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 20 Aug 2004
Article Copyright 2004 by kennedy_franklin
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid