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

Hi,

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.

Thanks
milani_lucieAsked:
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) _
                              MessageBox.Show(s.ToString())

Open in new window

0
 
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

0
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.