Hello,
I have a user control that consisting of UserControl, and one Form.
When UserControl Initialize it opens that Form.
In that form I would like to call an event that is fired from user control.
Here is a example:
Now when the usercontrol opens the Form1 in Form1 load event I want to call a public sub inside the usercontrol:Code:'Code In UserControl1 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit Public Event FormEvent(ByVal FormEventName As String) Public Sub OnFormEvent(ByVal localFormEventName As String) RaiseEvent FormEvent(localFormEventName) End Sub Private Sub UserControl_Initialize() Form1.Show End Sub
Is anyone having some ideas?Code:'Code In Form1 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Option Explicit Private Sub Form_Load() ' Call the sub inside UserControl1 End Sub
Here is a simple example.
UserControl_with_Form.zip




Reply With Quote
