Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RaiseEvent skipped 1

Status
Not open for further replies.

Reinout

IS-IT--Management
Feb 22, 2004
48
BE
I did a search in the forum but nothing seemed to work for me.

Where I want to call the event :

Public Class Test
Inherits System.Windows.Forms.UserControl
Public Event TestEvent()

Private sub initPage()
RaiseEvent TestEvent()
End sub
End Class



Where I tell the event what to do :

Public Class frmFood
Inherits frmBase (custom usercontrol)
Private WithEvents ucTest As Test
Within a sub :
ucTest = new Test(some parameters)

Private Sub ucTest_ChangeNode() Handles Test.ChangeNode
MsgBox("Change node")
End Sub
End Class
 
I will give this thread a high rating, cause it's important to see (not only for me) you can't raise an event while creating an instance of a class. One of my colleague had the same problem on a page, where multiple other raise-events were working correctly, but one failed.

Thanks a lot Jubble, we had no clue what to do.
 
I'm stoked you finally got it to work.

you can't raise an event while creating an instance of a class

did you find an article about this by any chance?.. it would be helpful for the dev team files.

I got educated too. Cheers.
 
I didn't find an article about it yet, but as we have 2 similar examples now of raise events not working while creating the instance of a (different) class, while the same events are working correctly on another place in the code, it seems very likely.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top