winforms - VB.Net 4.6 using Zipfile -
i have been searching site while , cant seem find solution. trying to use zipfile zip pdfs directory whenever type using zip zipfile = new zipfile
errors saying:
'using' operand of type 'system.io.compression.zipfile' must implement 'system.idisposable'
'system.io.compression.zipfile' has no constructors.
after searching through site found out had add references did added: system.io.compression
, system.io.compression.filesystem
made sure using correct .net framework , using .net 4.6 in vs 2013. stuck on do, wanted zip several files folder, can't use zipfile
. information on appreciated.
the code using is:
dim ziptocreate string = "ex1.zip" dim directorytozip string = "c:\temp" using zip zipfile = new zipfile dim filenames string() = system.io.directory.getfiles(directorytozip) dim filename string each filename in filenames zip.addfile(filename) next zip.save(ziptocreate) end using
from example -> how zip files in vb.net 2005
you mixing 2 different "zipfile" apis.
the sample code copied expects have reference dotnetzip library use zipfile
class, not part of .net framework.
the .net framework has zipfile
class, different api, , that's 1 code referring to.
pick 1 want use , make sure reference correct libraries , read appropriate documentation code properly.