Unzip Function

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Apr 2007
Posts: 10
Reputation: wonder_gal is an unknown quantity at this point 
Solved Threads: 0
wonder_gal wonder_gal is offline Offline
Newbie Poster

Unzip Function

 
0
  #1
Apr 11th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 11
Reputation: wavalker is an unknown quantity at this point 
Solved Threads: 1
wavalker wavalker is offline Offline
Newbie Poster

Re: Unzip Function

 
0
  #2
Apr 11th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 10
Reputation: wonder_gal is an unknown quantity at this point 
Solved Threads: 0
wonder_gal wonder_gal is offline Offline
Newbie Poster

Re: Unzip Function

 
0
  #3
Apr 11th, 2007
Originally Posted by wavalker View Post
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?
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 10
Reputation: wonder_gal is an unknown quantity at this point 
Solved Threads: 0
wonder_gal wonder_gal is offline Offline
Newbie Poster

Re: Unzip Function

 
0
  #4
Apr 11th, 2007
Hi all,

My problem been solved. Thanks for reading anyway.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 812
Reputation: arjunsasidharan is on a distinguished road 
Solved Threads: 13
arjunsasidharan's Avatar
arjunsasidharan arjunsasidharan is offline Offline
Practically a Posting Shark

Re: Unzip Function

 
0
  #5
Apr 11th, 2007
So what did you do to solve it?
There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 10
Reputation: wonder_gal is an unknown quantity at this point 
Solved Threads: 0
wonder_gal wonder_gal is offline Offline
Newbie Poster

Re: Unzip Function

 
0
  #6
Apr 11th, 2007
The problem came from the string array actually.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: Unzip Function

 
0
  #7
Apr 11th, 2007
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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 812
Reputation: arjunsasidharan is on a distinguished road 
Solved Threads: 13
arjunsasidharan's Avatar
arjunsasidharan arjunsasidharan is offline Offline
Practically a Posting Shark

Re: Unzip Function

 
0
  #8
Apr 11th, 2007
Originally Posted by hollystyles View Post
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
There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: Unzip Function

 
0
  #9
Apr 11th, 2007
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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 10
Reputation: wonder_gal is an unknown quantity at this point 
Solved Threads: 0
wonder_gal wonder_gal is offline Offline
Newbie Poster

Re: Unzip Function

 
0
  #10
Apr 11th, 2007
Originally Posted by hollystyles View Post
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.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC