Convert code line to VB.NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    #1

    Convert code line to VB.NET

    Hello,

    I am having problems in converting the following code line to VB.NET:

    Control[] list = MyFun(myControl , delegate(Contro l ctl) { ctl.ID ==
    "MyControl" ; });

    Could someone please help me out?

    Thanks,

    Miguel
  • Bill McCarthy

    #2
    Re: Convert code line to VB.NET

    Hi,

    "shapper" <mdmoura@gmail. comwrote in message
    news:0ba6d4c1-eadb-4be7-8007-b932b046ceed@y5 g2000hsf.google groups.com...
    Hello,
    >
    I am having problems in converting the following code line to VB.NET:
    >
    Control[] list = MyFun(myControl , delegate(Contro l ctl) { ctl.ID ==
    "MyControl" ; });
    >
    Could someone please help me out?
    >
    I thought I answered one of these earlier oday. Anyway, at a guess:

    Dim list As Control() = MyFun(myControl , Function(ctl As Control) ctl.Id =
    "MyControl" )



    Comment

    • Claes Bergefall

      #3
      Re: Convert code line to VB.NET

      VB.NET doesn't support anonymous methods (AFAIK anyway) so you'll have to
      make a separate function for the delegate. Something like this:

      Dim list As Control() = MyFun(myControl , AddressOf MyOtherFun)
      ....
      Private Sub MyOtherFun(ByVa l ctl As Control)
      ctl.ID = "MyControl"
      End Sub


      "shapper" <mdmoura@gmail. comwrote in message
      news:0ba6d4c1-eadb-4be7-8007-b932b046ceed@y5 g2000hsf.google groups.com...
      Hello,
      >
      I am having problems in converting the following code line to VB.NET:
      >
      Control[] list = MyFun(myControl , delegate(Contro l ctl) { ctl.ID ==
      "MyControl" ; });
      >
      Could someone please help me out?
      >
      Thanks,
      >
      Miguel
      >

      Comment

      Working...