Visual Studio – Add code to button

When this application runs, a message box appears with a welcome message.

Now we will add code to display Message box

On Window Form double click on the button. Following is an image of code view:

visual-studio-code-view
visual-studio-code-view

For Visual C#, the event handler should look like this:

visual-studio-event-handler
visual-studio-event-handler

For Visual C#, enter the following message box code:

visual-studio-event-handler
visual-studio-event-handler