Conversion from C++ (Eventhandler)

cockeyed

Member
Joined
Nov 21, 2008
Messages
14
Programming Experience
1-3
Hi,
I have found a sample code of something I am trying to complete in VB.Net however the sample is in C++, and I am having a hard time understanding how to translate it.

I have everything basically covered except for the actual EventHandler line.
If someone can please help translate this line for me, it would be greatly appreciated.

VB.NET:
{
     [B][I]this.Reader.ReadNotify += new EventHandler(Reader_ReadNotify);  [/I][/B]// specify event handler for reading barcode data
            this.Reader.Actions.Read(this.ReaderData);                      // this call activates the scanner's scanning ability
        }

        void Reader_ReadNotify(object sender, EventArgs e)
        {
            Symbol.Barcode.ReaderData nextReaderData = this.Reader.GetNextReaderData();
            this.textBox1.Text = nextReaderData.Text;                   // display barcode info on screen
            this.Reader.Actions.Read(this.ReaderData);                  // repeat loop by waiting for next barcode input
        }

I would like to know how to translate this easily into VB.Net.
I understand i may have to create an Event and a Raise Event, but not sure how.
 
Last edited:
Looks like c# to me. You should try this converter, its always worked well for me so far.

It converted the bold line to:
VB.NET:
[COLOR="Blue"]AddHandler Me[/COLOR].Reader.ReadNotify, [COLOR="#0000ff"]AddressOf[/COLOR] Reader_ReadNotify
 
Back
Top