Hi @pthsoon pthsoon ,
Please check if the follwing code works for you.
Private Sub AssosiateAndRaiseViewEvents()
AddHandler btnSearch.Click, AddressOf btnSearch_Click
AddHandler txtSearch.KeyDown, AddressOf txtSearch_KeyDown
End Sub
Private Sub btnSearch_Click()
searchEvent?.Invoke(Me, EventArgs.Empty)
End Sub
Private Sub txtSearch_KeyDown(sender As Object, e As KeyEventArgs)
If e.KeyCode = Keys.Enter Then SearchEvent?.Invoce(Me, EventArgs.Empty)
End Sub
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.