Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by Ariez

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Posted

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)

.nerd
Posted (edited)

No public variable declared withEvents==> can't catch its event anyways...

So bad question. sorry...:-\

Edited by Ariez

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

  • 2 weeks later...
Posted

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

Jarod
Posted
Well, the point was not to have "variables" declared. just the objects....

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Posted

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!

Auto-suggestion: "I have a life"

Uncontroled thinking: "So what the.."

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...