Ariez Posted April 11, 2003 Posted April 11, 2003 (edited) I'm not declaring the ComUnitClass like Dim WithEvents whatEver as ComUnitClass I add and remove these objects from an arrayList like this: ComList.Add(New ComUnitClass()) BUT i need ComUnitClass to raise events so where do i mention the WithEvents? Edited April 11, 2003 by Ariez Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
Heiko Posted April 11, 2003 Posted April 11, 2003 You'll probably need a member variable with events in the surrounding class. Private With Events mComUnit as ComUnitClass ... mComUnitClass = new ComUnitClass() ComList.Add (mComUnitClass) Quote .nerd
Ariez Posted April 11, 2003 Author Posted April 11, 2003 (edited) No public variable declared withEvents==> can't catch its event anyways... So bad question. sorry...:-\ Edited April 12, 2003 by Ariez Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
Jarod Posted April 22, 2003 Posted April 22, 2003 You should do something like that: dim myUnit as new ComUnitClass() AddHandler myUnit.myEvent, addressof me.MyUnit_myEventHandler ComList.Add(myUnit) Add an "AddHandler" line for each event you want to listen Quote Jarod
Ariez Posted April 23, 2003 Author Posted April 23, 2003 Well, the point was not to have "variables" declared. just the objects.... Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
*Gurus* Derek Stone Posted April 23, 2003 *Gurus* Posted April 23, 2003 How do you expect to catch an object's event without even having a reference to the object? The point is you cannot, as the two gentlemen above have pointed out through their examples. Quote Posting Guidelines
Ariez Posted April 23, 2003 Author Posted April 23, 2003 I already said it was a bad question derek, no need to reopen the wound.... I wish i had that kind of interest on my databinding question! Quote Auto-suggestion: "I have a life" Uncontroled thinking: "So what the.."
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.