G
Guest
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.MessagePriority.Highest;
else
theMessage.Priority=System.Messaging.MessagePriority.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();
}
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.MessagePriority.Highest;
else
theMessage.Priority=System.Messaging.MessagePriority.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();
}