|
Try using the Events from the MessageQueue object.
MessageQueue mq = new MessageQueue();
mq.ReceiveCompleted += new System.Messaging.ReceiveCompletedEventHandler(MessageQueue_ReceiveCompleted);
//Call this to start processing
mq.BeginReceive();
Then have the event handler that processes the delegate.
private void MessageQueue_ReceiveCompleted (object source, System.Messaging.ReceiveCompletedEventArgs asyncResult)
{
MessageQueue mq = null;
try
{
mq = (MessageQueue)source;
//Create a Message object and populate it from the event.
System.Messaging.Message mes = mq.EndReceive(asyncResult.AsyncResult);
//Do your message queue work here.
}
|
|
|
|
|
Hello
I had a question about named delegates. Now from my understanding named delegates can only hold references of a method that matches the signature of the delegate. I have a piece of code which is contrary to this statement.
Using System;
delegate int CountIt(int end);
class varCapture{
static CountIt counter()
{
int sum = 0;
CountIt ctObj = delegate(int end) {
for( int i = 0; i <= end; i++ )
{
Console.WriteLine(i);
sum += i;
}
return sum;
};
return ctObj;
}
public static void Main()
{
CountIt count = counter();
int result;
result = count(3);
}
Now the delegate of type CountIt must refer to a method that takes int as a parameter and returns int as a parameter.
CountIt count = counter();
In the following line the delegate count is pointing to the method with no parameters or return type. So I wanted to understand how is it possible?
Is this assignment possible because the counter() is returning a object of type CountIt(same as that of the delegate)? If so when CountIt count = counter(); is executed it calls counter() and then just initializes the CountIt object an return it, does it actually go into the anonymous method block code? If not why?
Thanks
Revant Jain
|
|
|
|
|
int MyMethod()
{
return 9;
}
int n = MyMethod();
That's all your code is doing, it's no mystery.
Revant Jain wrote: If so when CountIt count = counter(); is executed it calls counter() and then just initializes the CountIt object an return it, does it actually go into the anonymous method block code? If not why?
counter() returns an object, which is a delegate. So, this works. When the delegate fires, it will run the anonymous code, because that's how the delegate was defined.
The code is convoluted, but it's correct.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
AOA:
I have created mail merge fields in word document.
can wordpad or pdf has the support to create mail merge fields.
if yes then how???
thanx
|
|
|
|
|
I'm using a Type Library Importer (Tlbimp.exe) for converting Microsoft PowerPoint 12.0 Object Library(Office 2007) to an Interop dll. If the same dll is used in the system where Lower versions Microsoft PowerPoint(Office 2003) is installed. I'm facing an error
The Command used to convert into the dll.
TlbImp "C:\Program Files\Microsoft Office\OFFICE12\MSPPT.OLB" /keyfile:"C:\32\DotnetSigning\Signature.snk" /namespace:Interop.PowerPoint12 /out:"C:\New Folder\Interop.Office12.dll"
If i refer the dll in my C# .NET application. I'm facing with the below error;
"Assembly 'Interop.PowerPoint12, Version=2.9.0.0, Culture=neutral, PublicKeyToken=4316ebe69d6f1d49' uses 'office, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'"
Is there a work around for this error?
Thanks in advance,
Mayur
|
|
|
|
|
Does anyone knows about good free UI library or even collection of good UI Controls for vs 2005 ???
|
|
|
|
|
System.Windows.Forms :P
On a more serious note you'll generally have to pay for a good collection, if it's only a few specific controls your after then you might be able to search around until you find free versions of each of them.
|
|
|
|
|
Can any one help me in with documentation of RFC modules?
I need help regarding BDC function module(Recording and running a SAP transaction).
|
|
|
|
|
|
Hello,
You waited only 1/2 hour to post same question again?
What do you think, should be the effect of this rude behavoir?
Nobody will stop working just because you made a double post.
People are answering questions for free if they haev time. (And remember there are a lot of people sleeping wright now.)
Your post might get a reply in 6 hours or even later!
If it's that urgent you have to pay somebody.
P.S.:And it's not the first time you are doing so.
So please stop it!
All the best,
Martin
|
|
|
|
|
|
Albert Dadze wrote: You have a very good point and I like you for that.
Albert Dadze wrote: But don't you peradventure think the man who posted this might be quite desperate.
Maybe yes, I'm not in the position to say so!
But I think it's not the reason for his rude double post.
He is a member since 1year and 8monthm, with over 130 posts on the forums.
So he is well experienced and did it on purpose I think.
All the best,
Martin
|
|
|
|
|
|
How to display the selected tabItem used code?
I do not find method or attribute such as "selectdTab" or "displayTab".
please give me help,Thanks.
|
|
|
|
|
|
No, Mine is not System.Windows.Forms.Tabcontrol.
it is "DevComponents" company's.
|
|
|
|
|
|
|
|
Hello
I want to read a file that is located on another computer within a network.
reply me asap.
Devesh Mishra
|
|
|
|
|
Just use the network path the file and read as normal
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Thanks for ur reply.
Can u send me syntax of path for the file.
Devesh Mishra
|
|
|
|
|
\\machinename\c\filename
for example
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
There are two way to read the file.
1) Use the network path of the file to read at the local PC. The network path will be somthing like \\remotePCName\\folderName\\FileName.ext. But for this the file/folder needs to be shared on the network PC.
2) Write a Client/Server application. You can use Remoting or Socket for this purpose. Your Server should implement a interface with a function to accept the file name with path and will return the file contain as out parameter. In this case you needs to run the server at the remote PC and it must me running while you will read file containt from the client program.
Manoj
Never Gives up
|
|
|
|
|
Hi manoj,
Thanks 4 ur reply.
But still i m getting an error message i.e. "could not find the path"
can u tell me in some more detail way..like complete path for the file..or any live example...
Devesh Mishra
|
|
|
|