Use a RaiseEvent statement to raise an event VB.NET

3.8k views Asked by At

I get this error:

Error 1 'Public Event NewFrame(sender As Object, eventArgs As
AForge.Video.NewFrameEventArgs)' is an event, and cannot be called directly.
Use a 'RaiseEvent' statement to raise an event.
C:\Users\Jonathan\Documents\Visual Studio 2010\Projects\Stream\Stream\Form1.vb
9 9 Stream

My code is:

Enter image description here

How I can solve this?

1

There are 1 answers

0
ltiong_sh On BEST ANSWER

Not a VB buff, but I don't think that how you subscribe to events in VB. Try:

Dim stream As New MJPEGStream("...")
AddHandler stream.NewFrame, AddressOf Me.video_NewFrame
...