Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 19, 2012 07:46 PM by David Anton
Nov 18, 2012 10:44 PM|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 04:21 AM|LINK
AddHandler _msmqQueue.ReceiveCompleted, AddressOf msmqQueue_ReceiveCompleted
Nov 19, 2012 04:28 AM|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 09:48 AM|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 07:46 PM|LINK
There's no risk - VB does things differently than C#. Simple as that.