The sample code below shows how to connect to a message queue and receive a message
System.Messaging.MessageQueue queue = new
System.Messaging.MessageQueue(".\Private$\MyPrivateQueue");
queue.Send("Sample message");
System.Messaging.Message msg = queue.Receive();
msg.Formatter = new System.Messaging.XmlMessageFormatter(
new string[] {"System.String"});
Console.WriteLine(msg.Body);