Zipup demo. vb error on unzip

Dec 19, 2010 at 1:53 PM

I ported the demo VB example called Zipup to VB2005  but the Unzip program gives the follow error in code
Error 1 Too few type arguments to 'System.Action(Of T)

The error is in the resetUI sub

What is the right use of action in VB2005

Coordinator
Dec 21, 2010 at 2:09 PM

I don't know the cause of the error you're seeing.   I can't see the code you're using and so I can only guess.

I suggest you read up on the use of the Action delegate type in VB2005.  I don't know exactly when the various features were added to the VB.NET compiler, and how to get the same feature in earlier versions, but I suppose the internet knows, and by searching you could find an answer to your specific question.

here's a start: http://blogs.msdn.com/b/kaevans/archive/2005/12/12/502742.aspx

Dec 30, 2010 at 12:03 PM
Hi

I have been checking a bit about the Action error in the resetUI sub rutine in VB2005
Since i'm newer do anything whith deligates before i do not know what to do.
What i have read, it looks like the Action in VB2008 can take no parameters and return no value
In VB2005 help for this says that it must have one parameter and return no value.
It looks like that in Vb2005 there must be some other way to do this without Action. But without knowing what to do i'm lost Sorry

Petter

From: [email removed]
To: [email removed]
Date: Tue, 21 Dec 2010 07:09:30 -0800
Subject: Re: Zipup demo. vb error on unzip [DotNetZip:238903]

From: Cheeso
I don't know the cause of the error you're seeing. I can't see the code you're using and so I can only guess.
I suggest you read up on the use of the Action delegate type in VB2005. I don't know exactly when the various features were added to the VB.NET compiler, and how to get the same feature in earlier versions, but I suppose the internet knows, and by searching you could find an answer to your specific question.
here's a start: http://blogs.msdn.com/b/kaevans/archive/2005/12/12/502742.aspx
Read the full discussion online.
To add a post to this discussion, reply to this email (DotNetZip@discussions.codeplex.com)
To start a new discussion for this project, email DotNetZip@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com
Coordinator
Jan 6, 2011 at 6:29 PM

In VB 2008, Action is a delegate type that can accept a variable number of typed arguments.  Action(of T) is a delegate that accepts a single argument of type T.  Since it returns "nothing", in VB.NET, it corresponds to a Sub that accepts a single argument. A delegate is just a variable that refers to such a Sub.  If that makes sense.  Here's an overview of Delegates in VB.NET: http://www.developerfusion.com/article/5251/delegates-in-vbnet/

I know how to do this in C#, but I'm not a VB expert, so I cannot just whip out some VB.NET code for you.  I know that it is possible to declare a delegate in VB2005 that connforms to that specification, though.

To declare an Action(Of T) in VB2005, try something like this:

Private Delegate Sub MyAction(ByVal arg As T)

Then, to use it, something like this:

Dim del As MyAction
del = New MyAction(AddressOf ActualNameOfSubroutineThatAcceptsOneArgOfTypeT)
del.Invoke(myargument)

But I don't know if that will make sense in the VB app you're writing.

Good luck.