Convert code line to VB.NET

S

shapper

Hello,

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

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

Could someone please help me out?

Thanks,

Miguel
 
B

bruce barker

vb.net 2.0 doesn't have anonymous delegates nor closure (couldn't go a
day without them). in vb.net you have to define the function then pass
the addressof it. I never use vb.net, so don't trust my syntax completely


function delfunction(ctl as Control) as bool
return ctl.id = "MyControl"
end function

dim mylist = myfunc(mycontrol, addressof delfunc) as ...


in vb2008, just use a lambda function.

-- bruce (sqlwork.com)


dim mylist = myfunc(mycontrol
 
S

shapper

vb.net 2.0 doesn't have anonymous delegates nor closure (couldn't go a
day without them). in vb.net you have to define the function then pass
the addressof it. I never use vb.net, so don't trust my syntax completely

function delfunction(ctl as Control) as bool
return ctl.id = "MyControl"
end function

dim mylist = myfunc(mycontrol, addressof delfunc) as ...

in vb2008, just use a lambda function.

-- bruce (sqlwork.com)

dim mylist = myfunc(mycontrol
I am having problems in converting the following code line to VB.NET:
Control[] list = MyFun(myControl, delegate(Control ctl) { ctl.ID ==
"MyControl"; });
Could someone please help me out?

Miguel

Hi,

I am using VS 2008 and .NET 3.5.
Could you tell me how the lambda function would look like in VB.NET?

I though I could use lambda only in C#.

Thanks,
Miguel
 
J

Juan T. Llibre

Did you try googling for lambda and "vb.net" ?

http://www.google.com/search?hl=en&q=lambda+"vb.net"




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
shapper said:
vb.net 2.0 doesn't have anonymous delegates nor closure (couldn't go a
day without them). in vb.net you have to define the function then pass
the addressof it. I never use vb.net, so don't trust my syntax completely

function delfunction(ctl as Control) as bool
return ctl.id = "MyControl"
end function

dim mylist = myfunc(mycontrol, addressof delfunc) as ...

in vb2008, just use a lambda function.

-- bruce (sqlwork.com)

dim mylist = myfunc(mycontrol
I am having problems in converting the following code line to VB.NET:
Control[] list = MyFun(myControl, delegate(Control ctl) { ctl.ID ==
"MyControl"; });
Could someone please help me out?

Miguel

Hi,

I am using VS 2008 and .NET 3.5.
Could you tell me how the lambda function would look like in VB.NET?

I though I could use lambda only in C#.

Thanks,
Miguel
 
S

shapper

Did you try googling for lambda and "vb.net" ?

http://www.google.com/search?hl=en&q=lambda+"vb.net"

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
======================================

shapper said:
vb.net 2.0 doesn't have anonymous delegates nor closure (couldn't go a
day without them). in vb.net you have to define the function then pass
the addressof it. I never use vb.net, so don't trust my syntax completely
function delfunction(ctl as Control) as bool
return ctl.id = "MyControl"
end function
dim mylist = myfunc(mycontrol, addressof delfunc) as ...
in vb2008, just use a lambda function.
-- bruce (sqlwork.com)
dim mylist = myfunc(mycontrol
shapper wrote:
Hello,
I am having problems in converting the following code line to VB.NET:
Control[] list = MyFun(myControl, delegate(Control ctl) { ctl.ID ==
"MyControl"; });
Could someone please help me out?
Thanks,
Miguel

I am using VS 2008 and .NET 3.5.
Could you tell me how the lambda function would look like in VB.NET?
I though I could use lambda only in C#.
Thanks,
Miguel

Yes,

And I get a lot of pages with discussion of lambda in VS 2008 Beta 1,
Beta 2, ways to go ...

Do you know a page where I can see the definite way to create lambdas
en vb.net? The final release ...

Thanks,
Miguel
 
J

Juan T. Llibre

re:
!> Do you know a page where I can see the definite way to create lambdas en vb.net?
!> The final release ...

http://msdn.microsoft.com/msdnmag/issues/07/09/BasicInstincts/

From within the VS 2008 IDE :
ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/dv_vbalr/html/137064b0-3928-4bfa-ba71-c3f9cbd951e2.htm



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
Did you try googling for lambda and "vb.net" ?

http://www.google.com/search?hl=en&q=lambda+"vb.net"

Juan T. Llibre, asp.net MVP
asp.net faq :http://asp.net.do/faq/
foros de asp.net, en español :http://asp.net.do/foros/
======================================

shapper said:
vb.net 2.0 doesn't have anonymous delegates nor closure (couldn't go a
day without them). in vb.net you have to define the function then pass
the addressof it. I never use vb.net, so don't trust my syntax completely
function delfunction(ctl as Control) as bool
return ctl.id = "MyControl"
end function
dim mylist = myfunc(mycontrol, addressof delfunc) as ...
in vb2008, just use a lambda function.
-- bruce (sqlwork.com)
dim mylist = myfunc(mycontrol
shapper wrote:
Hello,
I am having problems in converting the following code line to VB.NET:
Control[] list = MyFun(myControl, delegate(Control ctl) { ctl.ID ==
"MyControl"; });
Could someone please help me out?
Thanks,
Miguel

I am using VS 2008 and .NET 3.5.
Could you tell me how the lambda function would look like in VB.NET?
I though I could use lambda only in C#.
Thanks,
Miguel

Yes,

And I get a lot of pages with discussion of lambda in VS 2008 Beta 1,
Beta 2, ways to go ...

Do you know a page where I can see the definite way to create lambdas
en vb.net? The final release ...

Thanks,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top