Translating C#.NET to VB.NET

Joined
Dec 3, 2008
Messages
2
Reaction score
0
I have a code example from a company that sells software used to automate cameras. The C# code consists of the following pieces:

private OnImageNotificationDelegate OnImageReceivedCallback;

OnImageNotificationDelegate is defined

public delegate void OnImageNotificationDelegate(HermesImage image, int userData, IntPtr userPtr);

OnImageReceivedCallback is invoked:

OnImageReceivedCallback = new OnImageNotificationDelegate(OnImageReceived);

After that, OnImageReceived, which is declared below, is called when each frame arrives.

public void OnImageReceived(HermesImage image, int userData, IntPtr userPtr)
{
//System.Diagnostics.Trace.WriteLine("DemoGrab - OnImageReceived");
LastImage = image;

if(SequenceReady)
SampleSequence.Write(image);

Invalidate(false);
}

When translated into Visual Basic.NET (VB.NET 2008), we tried this:

Private OnImageReceivedCallBack As OnImageNotificationDelegate
or
Private OnImageReceivedCallBack As NorPix.HermesNET.OnImageNotificationDelegate ' fully qualified

then
OnImageReceivedCallBack = New OnImageNotificationDelegate(AddressOf OnImageReceived)

This is how we translated the subroutine:

Public Sub OnImageReceived(ByVal Image As HermesImage, ByVal userData As Integer, ByVal userPtr As IntPtr)
LastImage = Image
...
End Sub

The problem is that the subroutine, OnImageReceived, is never called, and we simply do not understand why.

Any ideas would be appreciated.

Rick
 
Last edited:
Joined
Dec 3, 2008
Messages
2
Reaction score
0
Solution found. Problem was elsewhere.

Turns out we asked the wrong question. The code I used was correct. The problem was elsewhere.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top