Last post Nov 19, 2012 03:46 PM by David Anton
Nov 18, 2012 06:44 PM|cheickna|LINK
I tried to convert a C# code to VB.Net code into my asp.net app but i get an error message about how call an Event.
The C# code is following :
string messageQueuePath = @".\private$\EmailQueue";
_msmqQueue = new MessageQueue(messageQueuePath);
_msmqQueue.Formatter = new BinaryMessageFormatter();
Console.WriteLine("Enter 'A' to Exit ");
I transformed all parts of this code except this :
The error message ask me to use RaiseEvent to call ReceiveCompleted because it is an Event when i use this conversion :
_msmqQueue.ReceiveCompleted += New ReceiveCompletedEventHandler(AddressOf msmqQueue_ReceiveCompleted)
I used AddressOf to avoid another error but i always have tne Event Error.
Thank's a lot for any help
Nov 19, 2012 12:21 AM|David Anton|LINK
AddHandler _msmqQueue.ReceiveCompleted, AddressOf msmqQueue_ReceiveCompleted
Nov 19, 2012 12:28 AM|iGulfam|LINK
Dim messageQueuePath As String = ".\private$\EmailQueue"
_msmqQueue = New MessageQueue(messageQueuePath)
_msmqQueue.Formatter = New BinaryMessageFormatter()
_msmqQueue.ReceiveCompleted += New ReceiveCompletedEventHandler(msmqQueue_ReceiveCompleted)
Console.WriteLine("Enter 'A' to Exit ")
While Console.ReadKey().Key <> ConsoleKey.A
Catch oEx As Exception
Nov 19, 2012 05:48 AM|cheickna|LINK
Thank's for your reply, but if you convert this sentence
by this one :
Where is the '+=' operator ?
Is there a risk without this operator to lost some informations?
Thank's in advance for your reply
Nov 19, 2012 03:46 PM|David Anton|LINK
There's no risk - VB does things differently than C#. Simple as that.