need help in raising events
hi! I'm just new in programming in vb.net. I have a user control that raises an event which is handled by the form where the control is loaded. the user control and the form are located in two separate projects and the control is loaded dynamically.
This is my code for the user control:
Public Delegate Sub ClearAllControls(ByVal bytIQAType As Byte)
Public Class ctlControl
Inherits System.Windows.Forms.UserControl
Public Event ClearAllCtrls As ClearAllControls
Private Sub btnClearAll_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClearAll.Click
Try
RaiseEvent ClearAllCtrls(bytIQAType)
Catch ex As Exception
Call MsgBox(ex.Message)
End Try
End Sub
End Class
This is my code for the form:
Public Class frmForm
Inherits System.Windows.Forms.Form
Public WithEvents ctlCtrl as prjControl.ctlControl
Public Sub ctlCtrl_ClearAllCtrls(ByVal bytIQAType As Byte) Handles ctlCtrl.ClearAllCtrls
Try
'call clear all of all loaded controls
Catch ex As Exception
call MsgBox(ex.Message)
End Try
End Sub
End Class
My problem is that when RaiseEvent is called it doesn't go to the ctlCtrl_ClearAllCtrls method in frmForm and just moves on to End Try. No error or exception occurs so I don't know what the problem is. Need help pls!