English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

e.g.
Dim list As New PersonsBindingList(Of Person)
Dim p As New Person("Peter")
list.Add(p)

Within the Person class, I want to raise a custom event in the PersonsBindingList. How can this be accomplished? Must I also pass the list object to the constructor of the Person class so that I can obtain a reference to the list within the Person class and then use RaiseEvent list.MyCustomEvent()? Is there a better way?

Thank you.

2007-03-15 11:15:36 · 1 answers · asked by Hello World 1 in Computers & Internet Programming & Design

1 answers

You should create an EventArgs class that has a PersonsBindingList property, and pass that to your PersonEvent. Then your event handler signature should look like:

Sub MyHandler(sender As Object, e As PersonEventArgs)

sender should be the Person instance
and you can reference your list by referencing e.PersonsBindingList

2007-03-15 12:56:56 · answer #1 · answered by Rex M 6 · 0 0

fedest.com, questions and answers