How do I Convert from Anonymous Event Handlers in C# to VB.Net

后端 未结 1 1099
时光取名叫无心
时光取名叫无心 2021-01-26 13:20

I have the below example code for a Windows Phone 7 application, and I am trying to convert it to VB.Net as a starting point. The assignments like this:

Loaded +         


        
1条回答
  •  天命终不由人
    2021-01-26 13:58

    The Loaded event handler is defined in the C# code you posted using a lambda expression. I suppose most VB.NET-C# converters don't handle those very well, since they are relatively new. Try this:

    AddHandler Loaded, Sub() 'Pass the Loaded event parameters, I cannot see them in your code
                      'The code inside the big block
                       End Sub
    

    You don't need to call RemoveHandler (read comments below).

    0 讨论(0)
提交回复
热议问题