943,983 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 11661
  • VB.NET RSS
Apr 11th, 2007
0

Unzip Function

Expand Post »
Hi,

I am writing a function to unzip a zipped file. But I'm getting this error, "Cast from string "C:\temp\FileName.zip" to type 'Integer' is not valid." Below is my coding, I got this error in the bold line. May I know what does the casting error mean here? Why do I need to cast the string of my zip file path to integer?

ExtractZIPfiles(Directory.GetFiles(strFullDirectoryPath, "*.Zip"))


Private Sub ExtractZIPfiles(ByVal pathList() As String)
        Dim x As New ICSharpCode.SharpZipLib.Zip.FastZip
        Dim strFullDirectoryPath As String = Path.GetFullPath("C:\temp")

        For Each s As String In pathList

            x.ExtractZip(pathList(s), strFullDirectoryPath, "csv;xsl")

        Next
End Sub
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wonder_gal is offline Offline
10 posts
since Apr 2007
Apr 11th, 2007
0

Re: Unzip Function

Private Sub ExtractZIPfiles(ByVal pathList() As String)
Dim x As New ICSharpCode.SharpZipLib.Zip.FastZip
Dim strFullDirectoryPath As String = Path.GetFullPath("C:\temp")

For Each s As String In pathList

x.ExtractZip(pathList(s), strFullDirectoryPath, "csv;xsl")

Next
End Sub
hi,
above function's return type may be an integer so u need to declare one variable as integer and rewrite it again as like follows
dim y as int
y=x.ExtractZip(pathList(s), strFullDirectoryPath, "csv;xsl")
it will be execute properly
Last edited by wavalker; Apr 11th, 2007 at 2:32 am.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
wavalker is offline Offline
11 posts
since Apr 2007
Apr 11th, 2007
0

Re: Unzip Function

Click to Expand / Collapse  Quote originally posted by wavalker ...
Private Sub ExtractZIPfiles(ByVal pathList() As String)
Dim x As New ICSharpCode.SharpZipLib.Zip.FastZip
Dim strFullDirectoryPath As String = Path.GetFullPath("C:\temp")

For Each s As String In pathList

x.ExtractZip(pathList(s), strFullDirectoryPath, "csv;xsl")

Next
End Sub
hi,
above function's return type may be an integer so u need to declare one variable as integer and rewrite it again as like follows
dim y as int
y=x.ExtractZip(pathList(s), strFullDirectoryPath, "csv;xsl")
it will be execute properly
Hi,

I've tried your suggestion, it cannot work, because it says the expression

x.ExtractZip(pathList(s), strFullDirectoryPath, "csv;xsl")

does not return a value.

So anymore suggestion?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wonder_gal is offline Offline
10 posts
since Apr 2007
Apr 11th, 2007
0

Re: Unzip Function

Hi all,

My problem been solved. Thanks for reading anyway.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wonder_gal is offline Offline
10 posts
since Apr 2007
Apr 11th, 2007
0

Re: Unzip Function

So what did you do to solve it?
Reputation Points: 347
Solved Threads: 13
Practically a Posting Shark
arjunsasidharan is offline Offline
812 posts
since Aug 2006
Apr 11th, 2007
0

Re: Unzip Function

The problem came from the string array actually.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wonder_gal is offline Offline
10 posts
since Apr 2007
Apr 11th, 2007
0

Re: Unzip Function

This pathList(s) is evaluated before the ExtractZip method, pathList is an array and requires an integer argument in the parenthesis representing the index number, but string s is being passed instead.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Apr 11th, 2007
0

Re: Unzip Function

This pathList(s) is evaluated before the ExtractZip method, pathList is an array and requires an integer argument in the parenthesis representing the index number, but string s is being passed instead.


oh yeah now i get it. Thanks
Reputation Points: 347
Solved Threads: 13
Practically a Posting Shark
arjunsasidharan is offline Offline
812 posts
since Aug 2006
Apr 11th, 2007
0

Re: Unzip Function

wonder_gal,

as you're new just to let you know, we like to explain solutions as much as possible so that other visitors with similar problems can learn from existing threads instead of starting new ones. Also as you are the owner of this thread you can mark it as solved there is an option on the screen that only you will see, that's also helpful for us to know so we don't waste time reading solved threads.

Thanks for your contribution.
Last edited by hollystyles; Apr 11th, 2007 at 8:59 am.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Apr 11th, 2007
0

Re: Unzip Function

wonder_gal,

as you're new just to let you know, we like to explain solutions as much as possible so that other visitors with similar problems can learn from existing threads instead of starting new ones. Also as you are the owner of this thread you can mark it as solved there is an option on the screen that only you will see, that's also helpful for us to know so we don't waste time reading solved threads.

Thanks for your contribution.

Icic, I got it. I just marked this post as SOLVED already.
Thanks to everyone here for sharing.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wonder_gal is offline Offline
10 posts
since Apr 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: setup package
Next Thread in VB.NET Forum Timeline: Windows Mobile & Datagrid





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC