Click here to Skip to main content
15,905,420 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am trying to populate my msqmq Q in my datagrid view,

I used the property below to receive the queue but,
mes = Queue.Receive(new TimeSpan(0, 0, 3)); .
The problem with this is it will delete the queue also, so some one suggested using peek.

mes = Queue.Peek(new TimeSpan(0, 0, 3));
But it only gets the top queue,
how can I get all the queue's? I was reading something about 'enumerator' but couldn't find examples to solve my problem.
Posted
Updated 9-Aug-11 21:54pm
v2

1 solution

You can use Peek with a cursor as discussed here[^].
 
Share this answer
 
Comments
shan1395 10-Aug-11 21:39pm    
i used enumerator to solve this problem

MessageEnumerator Enum = mq.GetMessageEnumerator2();
while (Enum.MoveNext())
{
mes = Enum.Current;
mes.Formatter = new XmlMessageFormatter(new string[] { "System.String,mscorlib" });
m = mes.Body.ToString();
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900