| | |
Unzip Function
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2007
Posts: 10
Reputation:
Solved Threads: 0
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?
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•
•
Join Date: Apr 2007
Posts: 11
Reputation:
Solved Threads: 1
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
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.
•
•
Join Date: Apr 2007
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
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
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?
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. There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
One is as though nothing is a miracle.
The other is as if everything is.
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.
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.
•
•
Join Date: Apr 2007
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
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.
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: setup package
- Next Thread: Windows Mobile & Datagrid
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex remove right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey table temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year






