Click here to Skip to main content
12,998,054 members (53,895 online)
Rate this:
Please Sign up or sign in to vote.
See more:
after convering my code from c# to, this code gives me an error

Private Sub VoiceRoom_Load(sender As Object, e As EventArgs)
            sound = New DirectSoundHelper()
            sound.OnBufferFulfill += New EventHandler(SendVoiceBuffer)
        End Sub

OnBufferFulfill is an event
Posted 18-Nov-12 7:22am
Sergey Alexandrovich Kryukov 18-Nov-12 14:02pm
What error? It's not nice to ask about an error without showing comprehensive error information.
Also, explain your ultimate goal. What do you want to do with the sound? What's your application type?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Event is not called, its is invoked. Invocation is the mechanism when the event instance lists all the item in the event invocation list and invokes each of the items, and the item is a single-case delegate instance; this way, all the handlers of the event get called.

The important limitation of this mechanism is that the invocation can only be done in the class where the even is declared, nowhere else, not even in a derived class. This is done via a call to event instance's Invoke method.

Your code is not trying to invoke the event; and you probably never need it. You only need to invoke event you declare in your own class or structure. In your code, you are trying to add a handler to an event instance. First of all, the handler type should match appropriate delegate type. I don't know what is the type DirectSoundHelper, so you need to find out appropriate delegate type for the event. First of all, learn how to work with events in VB.NET:[^],[^].

This is a short CodeProject article: Step by Step: Event handling in VB.NET[^].

Also, I doubt you really need any Direct Sound wrapper; usually .NET along is enough. But it depends on your purpose you did not share with us. That's why it's very important to start your questions with explanations of your ultimate goals.

Nelek 18-Nov-12 16:58pm
OP Comment to you moved here from non solution below
thanks a lot ,that example has helped me, am trying to develop a voice chat application,i found one but it was in c# ,so i converted the code to and part kept giving me an error
Sergey Alexandrovich Kryukov 18-Nov-12 18:37pm
Great. You are welcome.
Good luck, call again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 18 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100