Delegates for VB

  • Thread starter Thread starter tshad
  • Start date Start date
T

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.

Thanks,

Tom
 
tshad said:
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
 
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
 
tshad said:
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
 
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(ByVal sender As System.Object, ByVal e
As System.EventArgs) 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
 
Lloyd Sheen said:
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:

http://blog.steeleprice.net/archive/2006/09/28/914.aspx

"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? "

http://www.developer.com/net/vb/article.php/3514906

"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
 
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
 
Back
Top