Convert C# code to vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veenna
    New Member
    • Dec 2007
    • 65

    Convert C# code to vb.net

    hi,

    How to write the VB.NET equivalent code for the following line.

    Code:
    popupCanvas.MouseLeftButtonDown += (sender, e) => { HidePopup(); };
    I tried to convert code using Converter, But its not correct code.

    Regards,
    Veena
  • veenna
    New Member
    • Dec 2007
    • 65

    #2
    hi,

    I found solution, create an event and Call the function in that
    Code:
     
    AddHandler popupCanvas.MouseLeftButtonDown, AddressOf MouseLeftButtonDown
    
    
    
    Private Sub MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
            HidePopup()
        End Sub

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      I'm glad you solved your problem!
      Thank you for sharing your solution :)

      -Frinny

      Comment

      • PsychoCoder
        Recognized Expert Contributor
        • Jul 2010
        • 465

        #4
        You could also try this (though not as readable as your solution (It's a Lambda function)

        Code:
        popupCanvas.MouseLeftButtonDown += Function(sender As object, e As MouseButtonEventArgs) Do
        	HidePopup()
        End Function

        Comment

        Working...