In VB6,
I open a modal form from class mod. Declared an event in the form. When the user click on OK button in the form, I raise an event and want to capture this event in the class module from where the form was opened. In the class mod, I've implemented WithEvents to capture the raised event from the form, but the control doesn't flow to the class mod when the event is raised in form. What should I be doing to fix this problem?
Thanks.
'frmSelect
Option Explicit
Public Event SelectedItem()
Private Sub cmdOK_Click()
RaiseEvent SelectedItem
End Sub
'class
Private WithEvents mevtSelect As frmSelect
Private Sub DisplayForm()
Dim objfrmSelect As frmSelect
Set objfrmSelect = New frmSelect
objfrmSelect.Load orecordset
objfrmSelect.Show vbModal
Unload objfrmSelect
Set objfrmSelect = Nothing
End Sub
Private Sub mevtSelect_SelectedItem()
---do something
End Sub
I open a modal form from class mod. Declared an event in the form. When the user click on OK button in the form, I raise an event and want to capture this event in the class module from where the form was opened. In the class mod, I've implemented WithEvents to capture the raised event from the form, but the control doesn't flow to the class mod when the event is raised in form. What should I be doing to fix this problem?
Thanks.
'frmSelect
Option Explicit
Public Event SelectedItem()
Private Sub cmdOK_Click()
RaiseEvent SelectedItem
End Sub
'class
Private WithEvents mevtSelect As frmSelect
Private Sub DisplayForm()
Dim objfrmSelect As frmSelect
Set objfrmSelect = New frmSelect
objfrmSelect.Load orecordset
objfrmSelect.Show vbModal
Unload objfrmSelect
Set objfrmSelect = Nothing
End Sub
Private Sub mevtSelect_SelectedItem()
---do something
End Sub