Delegates for VB

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

    #1

    Delegates for VB

    I don't think there are delegates for VB as there is for C#.

    Why is that and are they planning to add this? This seems to be the only
    thing that VB doesn't have that C# does.

    Thanks,

    Tom


  • Rory Becker

    #2
    Re: Delegates for VB

    Hello tshad,
    I don't think there are delegates for VB as there is for C#.
    >
    Why is that and are they planning to add this? This seems to be the
    only thing that VB doesn't have that C# does.
    >
    Try looking up the "delegate" keyword

    --
    Rory


    Comment

    • Lloyd Sheen

      #3
      Re: Delegates for VB


      "tshad" <tshad@dslextre me.comwrote in message
      news:udaDdp61IH A.1628@TK2MSFTN GP03.phx.gbl...
      >I don't think there are delegates for VB as there is for C#.
      >
      Why is that and are they planning to add this? This seems to be the only
      thing that VB doesn't have that C# does.
      >
      Thanks,
      >
      Tom
      >
      Delegates exit in both. Why or what make you feel they don't?

      LS

      Comment

      • Patrice

        #4
        Re: Delegates for VB

        "As there is" ? That is ? If I remember you don't have anonymous Delegates
        but else you have AFAIK pretty much the same...

        Try :
        http://msdn.microsoft.com/en-us/libr...11(VS.71).aspx

        --
        Patrice

        "tshad" <tshad@dslextre me.coma écrit dans le message de groupe de
        discussion : udaDdp61IHA.162 8@TK2MSFTNGP03. phx.gbl...
        I don't think there are delegates for VB as there is for C#.
        >
        Why is that and are they planning to add this? This seems to be the only
        thing that VB doesn't have that C# does.
        >
        Thanks,
        >
        Tom
        >

        Comment

        • Armin Zingler

          #5
          Re: Delegates for VB

          "tshad" <tshad@dslextre me.comschrieb
          I don't think there are delegates for VB as there is for C#.
          >
          Why is that and are they planning to add this? This seems to be the
          only thing that VB doesn't have that C# does.
          What makes you think this? VB does have delegates. The language wouldn't
          work without them (eg for events).


          Armin

          Comment

          • kimiraikkonen

            #6
            Re: Delegates for VB

            On Jun 26, 7:33 pm, "tshad" <ts...@dslextre me.comwrote:
            I don't think there are delegates for VB as there is for C#.
            >
            Why is that and are they planning to add this? This seems to be the only
            thing that VB doesn't have that C# does.
            >
            Thanks,
            >
            Tom
            As others have stated, it's sure VB.NET supports (and must have
            supported as well) delegates which are declared using "delegate"
            keyword, a sample would be:

            Private Delegate Sub MakeMeFeelGood( )
            Private Sub Runit()
            MsgBox("Ran!")
            End Sub

            Private Sub Button1_Click(B yVal sender As System.Object, ByVal e
            As System.EventArg s) Handles Button1.Click
            Dim instance As New MakeMeFeelGood( AddressOf Runit)
            instance.Invoke ()
            End Sub

            For more help, you can search Google, returning with a lot of articles
            about it.

            Hope this helps,

            Onur Güzel

            Comment

            • tshad

              #7
              Re: Delegates for VB


              "Lloyd Sheen" <a@b.cwrote in message
              news:%230vi0061 IHA.5176@TK2MSF TNGP02.phx.gbl. ..
              >
              "tshad" <tshad@dslextre me.comwrote in message
              news:udaDdp61IH A.1628@TK2MSFTN GP03.phx.gbl...
              >>I don't think there are delegates for VB as there is for C#.
              >>
              >Why is that and are they planning to add this? This seems to be the only
              >thing that VB doesn't have that C# does.
              >>
              >Thanks,
              >>
              >Tom
              >>
              >
              Delegates exit in both. Why or what make you feel they don't?\
              I found that in some articles, but I was reading about anonymous delegates,
              apparently:



              "Since we do not have Anonymous Delegates in VB, we have to make class1 to
              hold the State information and the Method (Sub) we want to run, the compiler
              in C# decided that should be class1 and class1.<Lock>b_ _0) Next we need to
              pass in all the state information that the Anonymous Delegate was allowed to
              just use, now are you starting to see why these things are cool? "



              "Thus far, anonymous methods haven't shown up in the current beta version of
              VB.NET 2.0. However, since VB is getting everything else-like generics and
              overloaded operators-I suspect anonymous methods are on the way too. This
              article shows how to define anonymous methods in C# and what they might look
              like in VB.NET."


              Just curious if this is the case and if so, is MS planning to add this?

              Thanks,

              Tom
              >
              LS

              Comment

              • Tom Shelton

                #8
                Re: Delegates for VB

                On 2008-06-26, tshad <tshad@dslextre me.comwrote:
                >
                "Lloyd Sheen" <a@b.cwrote in message
                news:%230vi0061 IHA.5176@TK2MSF TNGP02.phx.gbl. ..
                >>
                >"tshad" <tshad@dslextre me.comwrote in message
                >news:udaDdp61I HA.1628@TK2MSFT NGP03.phx.gbl.. .
                >>>I don't think there are delegates for VB as there is for C#.
                >>>
                >>Why is that and are they planning to add this? This seems to be the only
                >>thing that VB doesn't have that C# does.
                >>>
                >>Thanks,
                >>>
                >>Tom
                >>>
                >>
                >Delegates exit in both. Why or what make you feel they don't?\
                >
                I found that in some articles, but I was reading about anonymous delegates,
                apparently:
                >

                >
                "Since we do not have Anonymous Delegates in VB, we have to make class1 to
                hold the State information and the Method (Sub) we want to run, the compiler
                in C# decided that should be class1 and class1.<Lock>b_ _0) Next we need to
                pass in all the state information that the Anonymous Delegate was allowed to
                just use, now are you starting to see why these things are cool? "
                >

                >
                "Thus far, anonymous methods haven't shown up in the current beta version of
                VB.NET 2.0. However, since VB is getting everything else-like generics and
                overloaded operators-I suspect anonymous methods are on the way too. This
                article shows how to define anonymous methods in C# and what they might look
                like in VB.NET."
                >
                >
                Just curious if this is the case and if so, is MS planning to add this?
                >
                Thanks,
                >
                Tom
                >>
                >LS
                >
                >
                Sort of... VB2008 gets lambda experssions - which are essentially anonymous
                methods on steroids. Unfortunately, they are a bit crippled in VB - only
                allowing one line expressions. It's like the only reason they got added was
                to support LINQ... Oh, wait...

                --
                Tom Shelton

                Comment

                • Cor Ligthert[MVP]

                  #9
                  Re: Delegates for VB

                  Tshad,

                  Delegates are from more then 60 years in history where people where
                  programming to invoke (go to) memoryplaces instead of just simple write in
                  common language what they wanted to do.

                  VB for Net uses much more modern methods.
                  (Although is simple able to use delegates too)

                  Cor

                  "tshad" <tshad@dslextre me.comschreef in bericht
                  news:udaDdp61IH A.1628@TK2MSFTN GP03.phx.gbl...
                  >I don't think there are delegates for VB as there is for C#.
                  >
                  Why is that and are they planning to add this? This seems to be the only
                  thing that VB doesn't have that C# does.
                  >
                  Thanks,
                  >
                  Tom
                  >

                  Comment

                  • Patrice

                    #10
                    Re: Delegates for VB

                    So it was really about anonymous delegates ?

                    I never gave this a close look but :
                    - IMO it would be messy for anything else than very simple cases as VB needs
                    a continuation line so anyway if you are not in a simple case it's likely
                    best to not have them anonymous)...
                    - I wonder if it couldn't be done with System.Action or something similar as
                    it would allow to create a delegate from a lambda...

                    --
                    Patrice




                    Comment

                    • rowe_newsgroups

                      #11
                      Re: Delegates for VB

                      It's like the only reason they got added was
                      to support LINQ...  Oh, wait...
                      LOL!

                      Thanks,

                      Seth Rowe [MVP]



                      Comment

                      Working...