By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,851 Members | 1,752 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,851 IT Pros & Developers. It's quick & easy.

Message Queues

P: n/a
I have created a program which sends a message to a message Queue called
MyMessage, and it is supposed to recieve it and show on a dataGrid.
When I click to send the message it doesn't seem to send it since I don't
see it in the server explorer and I also don't see it in the data grid
here is the code:
private void DisplayMessages()
{
DataTable messageTable = new DataTable();
messageTable.Columns.Add("Name");
messageTable.Columns.Add("Message");
messageTable.Columns.Add("Priority");
System.Messaging.Message[] messages;
messages = this.MyMessage.GetAllMessages();
System.Messaging.XmlMessageFormatter stringFormatter;
stringFormatter = new System.Messaging.XmlMessageFormatter(
new string[] {"System.String"});
for (int index = 0; index < messages.Length; index++)
{
messages[index].Formatter = stringFormatter;
messageTable.Rows.Add(new string[] {
messages[index].Label,
messages[index].Body.ToString(),
messages[index].Priority.ToString() });
}
messageGrid.DataSource = messageTable;
}
private void sendMessage_Click(object sender, System.EventArgs e)
{
System.Messaging.Message theMessage= new
System.Messaging.Message(this.txtMessage.Text);
theMessage.Label=this.txtName.Text;
if(this.highPriority.Checked)
theMessage.Priority=System.Messaging.MessagePriori ty.Highest;
else
theMessage.Priority=System.Messaging.MessagePriori ty.Normal;
DisplayMessages();
}

private void refreshMessages_Click(object sender, System.EventArgs e)
{
DisplayMessages();
}

private void purgeMessages_Click(object sender, System.EventArgs e)
{
this.MyMessage.Purge();
DisplayMessages();
}
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Michael:

Are using the MessageQueue class with the Send & Relieve methods? I
don't see where theMessage object in sendMessage_Click is ever sent or
attached to a queue.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 22 Oct 2004 15:23:03 -0700, "Michael"
<Mi*****@discussions.microsoft.com> wrote:
I have created a program which sends a message to a message Queue called
MyMessage, and it is supposed to recieve it and show on a dataGrid.
When I click to send the message it doesn't seem to send it since I don't
see it in the server explorer and I also don't see it in the data grid
here is the code:
private void DisplayMessages()
{
DataTable messageTable = new DataTable();
messageTable.Columns.Add("Name");
messageTable.Columns.Add("Message");
messageTable.Columns.Add("Priority");
System.Messaging.Message[] messages;
messages = this.MyMessage.GetAllMessages();
System.Messaging.XmlMessageFormatter stringFormatter;
stringFormatter = new System.Messaging.XmlMessageFormatter(
new string[] {"System.String"});
for (int index = 0; index < messages.Length; index++)
{
messages[index].Formatter = stringFormatter;
messageTable.Rows.Add(new string[] {
messages[index].Label,
messages[index].Body.ToString(),
messages[index].Priority.ToString() });
}
messageGrid.DataSource = messageTable;
}
private void sendMessage_Click(object sender, System.EventArgs e)
{
System.Messaging.Message theMessage= new
System.Messaging.Message(this.txtMessage.Text);
theMessage.Label=this.txtName.Text;
if(this.highPriority.Checked)
theMessage.Priority=System.Messaging.MessagePriori ty.Highest;
else
theMessage.Priority=System.Messaging.MessagePriori ty.Normal;
DisplayMessages();
}

private void refreshMessages_Click(object sender, System.EventArgs e)
{
DisplayMessages();
}

private void purgeMessages_Click(object sender, System.EventArgs e)
{
this.MyMessage.Purge();
DisplayMessages();
}


Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.