Can you provide VB.NET code for this C# code ?


Here is the code in C#. Can you provide me the equivalent code in VB.NET ?

ConfirmWindow confirm = new ConfirmWindow();
confirm.Closed += (s, ea) =>
       // Do Something

Please note that confirm.Closed is an event.

Who is Participating?
käµfm³d 👽Connect With a Mentor Commented:
Sorry, that should be a Sub instead:

AddHandler Me.FormClosed, Sub(s As Object, ea As EventArgs) _

Open in new window

käµfm³d 👽Commented:
Try this:

Dim confirm As New ConfirmWindow()

AddHandler confirm.Closed, Function (s As Object, ea As EventArgs) _
                                                ' Do Something _
                                            End Function

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.