473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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
Jun 27 '08 #1
10 1189
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
Jun 27 '08 #2

"tshad" <ts***@dslextreme.comwrote in message
news:ud**************@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
Delegates exit in both. Why or what make you feel they don't?

LS

Jun 27 '08 #3
"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" <ts***@dslextreme.coma écrit dans le message de groupe de
discussion : ud**************@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
Jun 27 '08 #4
"tshad" <ts***@dslextreme.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

Jun 27 '08 #5
On Jun 26, 7:33 pm, "tshad" <ts...@dslextreme.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(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
Jun 27 '08 #6

"Lloyd Sheen" <a@b.cwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>
"tshad" <ts***@dslextreme.comwrote in message
news:ud**************@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

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
>
LS

Jun 27 '08 #7
On 2008-06-26, tshad <ts***@dslextreme.comwrote:
>
"Lloyd Sheen" <a@b.cwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>
"tshad" <ts***@dslextreme.comwrote in message
news:ud**************@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

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
>>
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
Jun 27 '08 #8
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" <ts***@dslextreme.comschreef in bericht
news:ud**************@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
Jun 27 '08 #9
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


Jun 27 '08 #10
It's like the only reason they got added was
to support LINQ... *Oh, wait...
LOL!

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
Jun 27 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jeffrey T. Smith | last post by:
Back when the new J2SE1.5 features were announced, there was a JavaLive community chat (http://java.sun.com/developer/community/chat/JavaLive/2003/jl0729.html) in which Neal Gafter explains the...
3
by: Sam | last post by:
I’m just starting to learn delegates. I’m at the very beginning. If I understand correctly, delegates are for when you want to pass a function as a parameter. For example the client provides a...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
4
by: AMDRIT | last post by:
I am trying to understand Delegates and where/when to use them. I can see one potential use of a delegate (on form closing, set the cancel property in the event arguments.) Does anyone have a...
6
by: =?Utf-8?B?Sko=?= | last post by:
I have a logger component that logs to multiple sources, ie textfile, eventlog etc. and I have two methods that depending on where I call up my logger comp. one of them will be called. For ex. if...
0
by: bharathreddy | last post by:
Delegates Here in this article I will explain about delegates in brief. Some important points about delegates. This article is meant to only those who already know delegates, it will be a quick...
6
by: =?Utf-8?B?T2xkQ2FEb2c=?= | last post by:
My question is regarding the use of delegates in C#. I see how .Net uses delegates to wire event handlers to events. It’s an object created by a single line of code by the system and that makes...
7
by: Siegfried Heintze | last post by:
I'm studying the book "Microsoft Visual Basic.NET Language Reference" and I would like some clarify the difference between events and delegates. On page 156 I see a WinForms example of timer that...
69
by: raylopez99 | last post by:
They usually don't teach you in most textbooks I've seen that delegates can be used to call class methods from classes that are 'unaware' of the delegate, so long as the class has the same...
9
by: raylopez99 | last post by:
Hello all— I’m trying to get the below to work and cannot get the format right. It’s from this example: http://msdn.microsoft.com/en-us/library/8627sbea(VS.71).aspx What it is: I’m trying...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.