Some basic syntax to deal with handlers

[Migrated content. Thread originally posted on 02 December 2011]


How could I write this sentence in Visual COBOL?

listView1.RetrieveVirtualItem = new RetrieveVirtualItemEventHandler(listView1_RetrieveVirtualItem);

Thank you
  • Verified Answer

    invoke listView1::add_RetrieveVirtualItem(new System.Windows.Forms.RetrieveVirtualItemEventHandler(self::listView1_RetrieveVirtualItem)

    There is a demo program for Event Handlers in Visual COBOL.
    Take a look at C:\Users\Public\Documents\Micro Focus\Visual COBOL 2010\Samples\COBOL for .NET\Events
    or open up the Samples Browser in the Visual COBOL group and choose Events.

    The sample for Delegates might also be useful...
  • Thanks, Just I have found this example too:

    set MsgArrivedEvent to type Delegate::Combine
                new MsgArrivedEventHandler(self::My_MsgArrivedEventCallback)
            ) as type MsgArrivedEventHandler