How to fire a event in usercontrol from main form

Sudip Bhatt 2,276 Reputation points
2021-01-11T08:56:44.18+00:00

i am adding usercontrol onto main form in loop. now how can i fire event in user controls from main form. is it possible. if yes then please discuss with a example code. thanks

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,917 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,626 Reputation points
    2021-01-13T03:03:57.463+00:00

    Hi SudipBhatt-9737,
    What is your event in your user control? Please provide more details.
    And I found some code examples in these links you can refer to.
    How do I make an Event in the Usercontrol and have it handled in the Main Form?
    How to fire event in user control from my main form
    Best Regards,
    Daniel Zhang


    If the response 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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.