Gets or sets the message label.
[Visual Basic] Overridable Public Property Label As String [C#] public string Label {virtual get; virtual set;} [C++] public: __property virtual String* get_Label(); public: __property virtual void set_Label(String*); [JScript] public function get Label() : String; public function set Label(String);
The label of the message. The default is an empty string ("").
Label provides access to the Label property of the Message Queuing MSMQMessage object.
The following example creates an empty message. The example populates the Message with a string Body, sets the Label property, and then sends the message to a queue. It assumes there is a queue on the computer "myComputer" with the name "myQueue".
Import the System.Messaging namespace for this example.
[Visual Basic]
Private Sub CreateMessage() 'Declare a message and message queue Dim msg As Message Dim mq As MessageQueue 'Instantiate an empty message object msg = New Message 'Instantiate a new MessageQueue object mq = New MessageQueue("myComputer\myQueue") 'Set selected message properties. msg.Label = "My Message" msg.Body = "New Message Body" 'Send the message to the queue. mq.Send(msg) End Sub
Message Class | Message Members | System.Messaging Namespace