[
  {
    "Id": "222286",
    "ThreadId": "65267",
    "Html": "<p>Imports Ionic.Zip<br><br>Public Class Frm_Patcher<br><br>&nbsp;&nbsp;&nbsp; Private Shared justHadByteUpdate As Boolean = False<br><br>&nbsp;&nbsp;&nbsp; Public Shared Sub MyExtractProgress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If (<span style=\"color:#ff0000\"><span style=\"text-decoration:underline\">e.EventType</span></span> Is <span style=\"text-decoration:underline\"><span style=\"color:#ff0000\">ZipProgressEventType.Extracting_EntryBytesWritten</span>)</span> Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If <span style=\"color:#ff0000\"><span style=\"text-decoration:underline\">ExtractTest</span></span>.justHadByteUpdate Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.SetCursorPosition(0, Console.CursorTop)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.Write(&quot;&nbsp;&nbsp; {0}/{1} ({2:N0}%)&quot;, <span style=\"color:#ff0000\"><span style=\"text-decoration:underline\">e.BytesWritten</span></span>, <span style=\"color:#ff0000\"><span style=\"text-decoration:underline\">e.TotalBytesToWrite</span></span>, (CDbl(<span style=\"color:#ff0000\"><span style=\"text-decoration:underline\">e.BytesWritten</span></span>) / (0.01 * <span style=\"text-decoration:underline\"><span style=\"color:#ff0000\">e.TotalBytesToWrite</span></span>)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"text-decoration:underline\"><span style=\"color:#ff0000\">ExtractTest</span></span>.justHadByteUpdate = True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ElseIf (<span style=\"text-decoration:underline\"><span style=\"color:#ff0000\">e.EventType</span></span> Is <span style=\"text-decoration:underline\"><span style=\"color:#ff0000\">ZipProgressEventType.Extracting_BeforeExtractEntry</span></span>) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If <span style=\"color:#ff0000\"><span style=\"text-decoration:underline\">ExtractTest</span></span>.justHadByteUpdate Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(&quot;Extracting: {0}&quot;, <span style=\"text-decoration:underline\"><span style=\"color:#ff0000\">e.NameOfLatestEntry</span></span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style=\"color:#ff0000\"><span style=\"text-decoration:underline\">ExtractTest</span></span>.justHadByteUpdate = False<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp; End Sub<br><br><br>&nbsp;&nbsp;&nbsp; Private Sub MyExtract()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim Overwrite As ExtractExistingFileAction = ExtractExistingFileAction.OverwriteSilently<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim ZipToUnpack As String = &quot;C1P3SML.zip&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim UnpackDirectory As String = &quot;Extracted Files&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StatusMessage.Text = String.Format(&quot;Extracting file {0} to {1}&quot;, ZipToUnpack, UnpackDirectory)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddHandler zip1.ExtractProgress, AddressOf MyExtractProgress<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim e As ZipEntry<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' here, we extract every entry, but we could extract conditionally,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' based on entry name, size, date, checkbox status, etc.&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For Each e In zip1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.Extract(UnpackDirectory, Overwrite)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Using<br>&nbsp;&nbsp;&nbsp; End Sub<br><br>&nbsp;&nbsp;&nbsp; Private Sub Frm_Patcher_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MyExtract()<br>&nbsp;&nbsp;&nbsp; End Sub<br>End Class</p>\r\n<p>&nbsp;</p>\r\n<p>this is the code im useing copyed it right from the examples page.. i past it into my form like so and i get all sorts of errors.. what do i do? i want to make my fiel unzip and show its progress in progressbar1. sorry if this sounds kinda newbie but this is my first project in vs2008 im normally useing vb6 so .net is new to me this is actaully the only one i have got to work so far. i can exstract the file useing the example on the home page but i cant get the progress bar code here to work. and then once i get it working how do i call it to make th bar work.</p>\r\n<p>&nbsp;</p>\r\n<p>here are the errors</p>\r\n<p>i have colored red and underlined all the lines thats underlined in my code.</p>\r\n<p>Error&nbsp;&nbsp; &nbsp;1&nbsp;&nbsp; &nbsp;'Is' operator does not accept operands of type 'Ionic.Zip.ZipProgressEventType'. Operands must be reference or nullable types.<br>Error&nbsp;&nbsp; &nbsp;2&nbsp;&nbsp; &nbsp;'Is' operator does not accept operands of type 'Ionic.Zip.ZipProgressEventType'. Operands must be reference or nullable types.<br>Error&nbsp;&nbsp; &nbsp;3&nbsp;&nbsp; &nbsp;Name 'ExtractTest' is not declared.<br>Error&nbsp;&nbsp; &nbsp;4&nbsp;&nbsp; &nbsp;'BytesWritten' is not a member of 'Ionic.Zip.ExtractProgressEventArgs'.<br>Error&nbsp;&nbsp; &nbsp;5&nbsp;&nbsp; &nbsp;'TotalBytesToWrite' is not a member of 'Ionic.Zip.ExtractProgressEventArgs'.<br>Error&nbsp;&nbsp; &nbsp;6&nbsp;&nbsp; &nbsp;'BytesWritten' is not a member of 'Ionic.Zip.ExtractProgressEventArgs'.<br>Error&nbsp;&nbsp; &nbsp;7&nbsp;&nbsp; &nbsp;'TotalBytesToWrite' is not a member of 'Ionic.Zip.ExtractProgressEventArgs'.<br>Error&nbsp;&nbsp; &nbsp;8&nbsp;&nbsp; &nbsp;Name 'ExtractTest' is not declared.<br>Error&nbsp;&nbsp; &nbsp;9&nbsp;&nbsp; &nbsp;'Is' operator does not accept operands of type 'Ionic.Zip.ZipProgressEventType'. Operands must be reference or nullable types.<br>Error&nbsp;&nbsp; &nbsp;10&nbsp;&nbsp; &nbsp;'Is' operator does not accept operands of type 'Ionic.Zip.ZipProgressEventType'. Operands must be reference or nullable types.<br>Error&nbsp;&nbsp; &nbsp;11&nbsp;&nbsp; &nbsp;Name 'ExtractTest' is not declared.<br>Error&nbsp;&nbsp; &nbsp;12&nbsp;&nbsp; &nbsp;'NameOfLatestEntry' is not a member of 'Ionic.Zip.ExtractProgressEventArgs'.<br>Error&nbsp;&nbsp; &nbsp;13&nbsp;&nbsp; &nbsp;Name 'ExtractTest' is not declared.</p>\r\n<p>&nbsp;</p>\r\n<p>if you need anymore info let me know please im watching this post</p>",
    "PostedDate": "2009-08-11T18:32:31.577-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222292",
    "ThreadId": "65267",
    "Html": "<p>Spidey,</p>\r\n<p>check out <a href=\"http://code.msdn.microsoft.com/DotNetZip/Release/ProjectReleases.aspx?ReleaseId=2016\">the examples on msdn</a>.</p>\r\n<p>There is a VB.NET project that compiles and runs; it uses a progressbar. &nbsp; There's also a C# app that uses a progressbar.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-11T19:20:09.357-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222304",
    "ThreadId": "65267",
    "Html": "<p>i tryed that out its ziping the file i need to unzip it</p>",
    "PostedDate": "2009-08-11T20:18:16.297-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222314",
    "ThreadId": "65267",
    "Html": "<p>ok, well, instead of using the Saving_... event types, use the Extracting_... event types.</p>\r\n<p>&nbsp;</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> zip_ExtractProgress(<span style=\"color:Blue\">ByVal</span> sender <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Object</span>, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> ExtractProgressEventArgs)\r\n    <span style=\"color:Blue\">If</span> (e.EventType = (ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite <span style=\"color:Blue\">Or</span> ZipProgressEventType.Reading_ArchiveBytesRead)) <span style=\"color:Blue\">Then</span>\r\n        <span style=\"color:Blue\">&nbsp;</span>StepEntryProgress(e)\r\n    <span style=\"color:Blue\">ElseIf</span> (e.EventType = ZipProgressEventType.Extracting_BeforeExtractAll) <span style=\"color:Blue\">Then</span>\r\n        <span style=\"color:Blue\">&nbsp;</span>StepArchiveProgress(e)\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n    <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">&nbsp;</span>_setCancel <span style=\"color:Blue\">Then</span>\r\n        ' this Boolean would be set in a event handler for the cancel button<br>        e.Cancel = <span style=\"color:Blue\">True</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n</pre>\r\n</div>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> StepEntryProgress(<span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> ZipProgressEventArgs)\r\n    <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">&nbsp;</span>progressBar2.InvokeRequired <span style=\"color:Blue\">Then</span>\r\n        <span style=\"color:Blue\">&nbsp;</span>progressBar2.Invoke(<span style=\"color:Blue\">New</span> ZipProgress(<span style=\"color:Blue\">AddressOf</span> StepEntryProgress), <span style=\"color:Blue\">New</span> <span style=\"color:Blue\">Object</span>() { e })\r\n    <span style=\"color:Blue\">ElseIf</span> <span style=\"color:Blue\">Not</span> _operationCanceled <span style=\"color:Blue\">Then</span>\r\n        <span style=\"color:Blue\">If</span> (progressBar2.Maximum = 1) <span style=\"color:Blue\">Then</span>\r\n            ' first time through for the current entry<br>            progressBar2.Maximum = <span style=\"color:Blue\">CInt</span>(e.TotalBytesToTransfer)\r\n            'set a label with status information<br>            lblStatus.Text = <span style=\"color:Blue\">String</span>.Format(<span style=\"color:#A31515\">&quot;{0} of {1} files...({2})&quot;</span>, (_nFilesCompleted + 1), _totalEntriesToProcess, e.CurrentEntry.FileName)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n        ' do this every time<br>        progressBar2.Value = IIf((e.BytesTransferred &gt;= progressBar2.Maximum), progressBar2.Maximum, e.BytesTransferred)\r\n        <span style=\"color:Blue\">MyBase</span>.Update\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> StepArchiveProgress(<span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> ZipProgressEventArgs)\r\n    <span style=\"color:Blue\">If</span> progressBar1.InvokeRequired <span style=\"color:Blue\">Then</span>\r\n        progressBar1.Invoke(<span style=\"color:Blue\">New</span> ZipProgress(<span style=\"color:Blue\">AddressOf</span> StepArchiveProgress), <span style=\"color:Blue\">New</span> <span style=\"color:Blue\">Object</span>() { e })\r\n    <span style=\"color:Blue\">ElseIf</span> <span style=\"color:Blue\">Not</span> _operationCanceled <span style=\"color:Blue\">Then</span>\r\n        _nFilesCompleted = _nFilesCompleted+1<br>        progressBar1.PerformStep\r\n        progressBar2.Value = progressBar2.Maximum = 1\r\n        <span style=\"color:Blue\">MyBase</span>.Update\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span> \r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<p>I guess you'll be able to figure out the rest.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-11T20:56:44.07-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222328",
    "ThreadId": "65267",
    "Html": "<p>ok this is what i got so far no errors it exstracts the fiel just fine but there is no progress bars ether one..</p>\r\n<p>&nbsp;</p>\r\n<p>also i would like to not if it makes it simpler i dont need 2 progress bars one showing over all on one showing files.. i just need the one showing ovr all but im not sure yt how to remove the extra till i get them working.. so if you would like to remove it to make it easyer on you be my guest.</p>\r\n<p>&nbsp;</p>\r\n<p>anyways this is what i got</p>\r\n<p>&nbsp;</p>\r\n<p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">Imports</span> Ionic.Zip\r\n\r\n\r\n\r\n<span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Class</span> Frm_Patcher\r\n\r\n    <span style=\"color:Blue\">Private</span> _operationCanceled <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Boolean</span>\r\n    <span style=\"color:Blue\">Private</span> _nFilesCompleted <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>\r\n    <span style=\"color:Blue\">Private</span> _totalEntriesToProcess <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Delegate</span> <span style=\"color:Blue\">Sub</span> ZipProgress(<span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> SaveProgressEventArgs)\r\n\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> zip_ExtractProgress(<span style=\"color:Blue\">ByVal</span> sender <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Object</span>, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> ExtractProgressEventArgs)\r\n        <span style=\"color:Blue\">If</span> (e.EventType = (ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite <span style=\"color:Blue\">Or</span> ZipProgressEventType.Reading_ArchiveBytesRead)) <span style=\"color:Blue\">Then</span>\r\n            StepEntryProgress(e)\r\n        <span style=\"color:Blue\">ElseIf</span> (e.EventType = ZipProgressEventType.Extracting_BeforeExtractAll) <span style=\"color:Blue\">Then</span>\r\n            StepArchiveProgress(e)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> StepEntryProgress(<span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> ZipProgressEventArgs)\r\n        <span style=\"color:Blue\">If</span> progressBar2.InvokeRequired <span style=\"color:Blue\">Then</span>\r\n            progressBar2.Invoke(<span style=\"color:Blue\">New</span> ZipProgress(<span style=\"color:Blue\">AddressOf</span> StepEntryProgress), <span style=\"color:Blue\">New</span> <span style=\"color:Blue\">Object</span>() {e})\r\n        <span style=\"color:Blue\">ElseIf</span> <span style=\"color:Blue\">Not</span> _operationCanceled <span style=\"color:Blue\">Then</span>\r\n            <span style=\"color:Blue\">If</span> (progressBar2.Maximum = 1) <span style=\"color:Blue\">Then</span>\r\n                <span style=\"color:Green\">' first time through for the current entry</span>\r\n                progressBar2.Maximum = <span style=\"color:Blue\">CInt</span>(e.TotalBytesToTransfer)\r\n                <span style=\"color:Green\">'set a label with status information</span>\r\n                Txt_Output.Text = <span style=\"color:Blue\">String</span>.Format(<span style=\"color:#A31515\">&quot;{0} of {1} files...({2})&quot;</span>, (_nFilesCompleted + 1), _totalEntriesToProcess, e.CurrentEntry.FileName)\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n            <span style=\"color:Green\">' do this every time</span>\r\n            progressBar2.Value = IIf((e.BytesTransferred &gt;= progressBar2.Maximum), progressBar2.Maximum, e.BytesTransferred)\r\n            <span style=\"color:Blue\">MyBase</span>.Update()\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> StepArchiveProgress(<span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> ZipProgressEventArgs)\r\n        <span style=\"color:Blue\">If</span> progressBar1.InvokeRequired <span style=\"color:Blue\">Then</span>\r\n            progressBar1.Invoke(<span style=\"color:Blue\">New</span> ZipProgress(<span style=\"color:Blue\">AddressOf</span> StepArchiveProgress), <span style=\"color:Blue\">New</span> <span style=\"color:Blue\">Object</span>() {e})\r\n        <span style=\"color:Blue\">ElseIf</span> <span style=\"color:Blue\">Not</span> _operationCanceled <span style=\"color:Blue\">Then</span>\r\n            _nFilesCompleted = _nFilesCompleted + 1\r\n            progressBar1.PerformStep()\r\n            progressBar2.Value = progressBar2.Maximum = 1\r\n            <span style=\"color:Blue\">MyBase</span>.Update()\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> MyExtract()\r\n        <span style=\"color:Blue\">Dim</span> Overwrite <span style=\"color:Blue\">As</span> ExtractExistingFileAction = ExtractExistingFileAction.OverwriteSilently\r\n        <span style=\"color:Blue\">Dim</span> ZipToUnpack <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> = <span style=\"color:#A31515\">&quot;C1P3SML.zip&quot;</span>\r\n        <span style=\"color:Blue\">Dim</span> UnpackDirectory <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span> = <span style=\"color:#A31515\">&quot;Extracted Files&quot;</span>\r\n        Txt_Output.Text = <span style=\"color:Blue\">String</span>.Format(<span style=\"color:#A31515\">&quot;Extracting file {0} to {1}&quot;</span>, ZipToUnpack, UnpackDirectory)\r\n        <span style=\"color:Blue\">Using</span> zip1 <span style=\"color:Blue\">As</span> ZipFile = ZipFile.Read(ZipToUnpack)\r\n            <span style=\"color:Blue\">Me</span>._totalEntriesToProcess = zip1.EntryFileNames.<span style=\"color:Blue\">Count</span>\r\n            <span style=\"color:Blue\">Me</span>.SetProgressBars()\r\n            <span style=\"color:Blue\">AddHandler</span> zip1.ExtractProgress, <span style=\"color:Blue\">New</span> EventHandler(Of ExtractProgressEventArgs)(<span style=\"color:Blue\">AddressOf</span> zip_ExtractProgress)\r\n            <span style=\"color:Blue\">Dim</span> e <span style=\"color:Blue\">As</span> ZipEntry\r\n            <span style=\"color:Green\">' here, we extract every entry, but we could extract conditionally,</span>\r\n            <span style=\"color:Green\">' based on entry name, size, date, checkbox status, etc.   </span>\r\n            <span style=\"color:Blue\">For</span> <span style=\"color:Blue\">Each</span> e <span style=\"color:Blue\">In</span> zip1\r\n                e.Extract(UnpackDirectory, Overwrite)\r\n            <span style=\"color:Blue\">Next</span>\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Using</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> Cmd_Exit_Click(<span style=\"color:Blue\">ByVal</span> sender <span style=\"color:Blue\">As</span> System.Object, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> System.EventArgs) <span style=\"color:Blue\">Handles</span> Cmd_Exit.Click\r\n        <span style=\"color:Blue\">Me</span>._operationCanceled = <span style=\"color:Blue\">False</span>\r\n        <span style=\"color:Blue\">Me</span>._nFilesCompleted = 0\r\n        MyExtract()\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n    <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> SetProgressBars()\r\n        <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">Me</span>.ProgressBar1.InvokeRequired <span style=\"color:Blue\">Then</span>\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar1.Invoke(<span style=\"color:Blue\">New</span> MethodInvoker(<span style=\"color:Blue\">AddressOf</span> SetProgressBars))\r\n        <span style=\"color:Blue\">Else</span>\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar1.Value = 0\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar1.Maximum = <span style=\"color:Blue\">Me</span>._totalEntriesToProcess\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar1.Minimum = 0\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar1.<span style=\"color:Blue\">Step</span> = 1\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar2.Value = 0\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar2.Minimum = 0\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar2.Maximum = 1\r\n            <span style=\"color:Blue\">Me</span>.ProgressBar2.<span style=\"color:Blue\">Step</span> = 2\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Class</span>\r\n</pre>\r\n</div>\r\n</p>",
    "PostedDate": "2009-08-11T22:02:07.927-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222360",
    "ThreadId": "65267",
    "Html": "<p>&nbsp;</p>\r\n<p>ok, <a href=\"https://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=DotNetZip&ReleaseId=3097\">try this example</a>.</p>",
    "PostedDate": "2009-08-12T00:05:22.353-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222596",
    "ThreadId": "65267",
    "Html": "<p>that worked great and from that i can g mine working thanks alot.. also on a side note the refrance for ionic.zip was not found in the unzip project i had to add it myself.. dont knwo if you want to add that to it before others download but after adding it its wroking great..</p>\r\n<p>&nbsp;</p>\r\n<p>one thing though. y does it take so much to get a progress bar to move lol.. i mean bfore in vb6 it was a matter of adding a call to the unzip line to see how many files where in the zip then makeing the progressbar max the filel count then counting up the bar +1 each file.. all added about 5 lines max if that many.. but this wow that was alot of stuff to get the bar to move. is there a simpler way to do it and your jsut donig it the long way to do all the error checking and such? you cant just say</p>\r\n<p>for e &lt; filecount</p>\r\n<p>progressbar1.value = progressbar.value+1</p>\r\n<p>unzip(e) 'or whatever to unzip</p>\r\n<p>loop</p>\r\n<p>&nbsp;</p>\r\n<p>something simple like that is what i used in vb is it jsut .net thats makeing it so much more info needed now? or is it siply jsut how the dll was made to work?</p>\r\n<p>&nbsp;</p>\r\n<p>anyways thanks alot for your help i really appriciae it.</p>\r\n<p>ps sorry for the speling just work up still half awake lol.</p>",
    "PostedDate": "2009-08-12T09:30:32.067-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222605",
    "ThreadId": "65267",
    "Html": "<table border=0 width=800>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>You can compile code and add references to Visual Studio projects, you can reason about application design, but you're not able to spell or hit the Shift key?&nbsp;&nbsp;I think maybe it's not that you're half awake but just that you enjoy &quot;not speling&quot;. &nbsp; whatever.</p>\r\n<p>Yes, there are simpler ways to do it.&nbsp; What you described would work just fine, if you don't want a cancel capability. &nbsp;</p>\r\n<p>If you want to be able to cancel the extract part way through, then you need to do the extract on a background thread.&nbsp;</p>\r\n<p>If you do the extract in the button click event, then the extraction is being performed on the main, &quot;UI&quot; thread.&nbsp; Suppose the extraction takes 3 minutes - that can happen for big zip files.&nbsp; If the user clicks a cancel button during those three minutes, the application won't respond, because the main UI thread is busy extracting.&nbsp; When the extraction is done, the unzip button click event will complete, and then the cancel button click event will run.&nbsp; But by that time the unzip work is done.&nbsp; This obviously is not a responsive UI.</p>\r\n<p>To have a responsive UI, the application cannot do long-running work on the UI thread. That way the UI thread is always available for UI events - button clicks or whatever.</p>\r\n<p>So I had to kick-off a thread to do the extraction.&nbsp; That's half the complexity.&nbsp; The next half is - it's not possible to update the UI (like advance the progress bar) from the background thread.&nbsp; So, for each update of the progressbar (or enable/disable a button, etc), I need a&nbsp;separate method that calls to &quot;Control.InvokeRequired&quot;, and if that returns true, the method then calls itself via Invoke.&nbsp; This switches threads to allow the update of the control to happen on the main UI thread.</p>\r\n<p>All that complexity is necessary if you want a cancellable UI.</p>\r\n<p>It has nothing to do with DotNetZip.&nbsp;&nbsp; This is the way to make a cancellable UI in .NET WinForms, whenever you run a long-running task in response to a button click: Do the work on the background thread, and Control.Invoke() to update the UI.</p>\r\n<p>I did it the long way because it's an example, and I kinda want to publish good examples, in case people copy them.</p>\r\n<p>Actually, thinking about it, there&nbsp;<em>is </em>a bit of over-complexity just in the extraction.&nbsp; I call ExtractAll() and use a ExtractProgress method, but the way you described it - iterating through the entries and calling Extract() on each one - would work and would eliminate the need for the ExtractProgress event. The ExtractProgress is really necessary if:</p>\r\n<ul>\r\n<li>you want to have a progressbar and you call ExtractAll, OR</li>\r\n<li>you want to have 2 progress bars, one for the entry, and one for the entire archive. </li>\r\n</ul>\r\n<p>&nbsp;But even without the ExtractProgress, you still need the background thread and the Control.InvokeRequired.</p>\r\n<p>&nbsp;</p>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>",
    "PostedDate": "2009-08-12T09:56:02.623-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222616",
    "ThreadId": "65267",
    "Html": "<blockquote style=\"border:solid .1em #ccc;font-style:italic;margin:.25em 1em 0 1em;padding:0 .25em 0 .25em\"><strong>Cheeso wrote:</strong><br>\r\n<table border=0 width=800>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>You can compile code and add references to Visual Studio projects, you can reason about application design, but you're not able to spell or hit the Shift key?&nbsp;&nbsp;I think maybe it's not that you're half awake but just that you enjoy &quot;not speling&quot;. &nbsp; whatever.</p>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n</blockquote>\r\n<p>Why do you have to be so mean :P I did not know I was annoying you that much lol.. I apologized for the spelling. A few things are equating to the spelling.. A bad keyboard that wants to mis half the t's and i's I hit. Dyslexia, and the fact of being half awake. And I never was much on grammar hence the not hitting shift.</p>\r\n<p>I was simply just asking a question. And you answered it flawlessly as a matter of fact.. And it makes sense like I said in the beginning this is my first .net project normally I&rsquo;m using vb6 and I can only go from what I know there. So I did not know if it was something to do with .net or the dll or if it was you just doing it in example format to produce a good example for others to follow also. I&rsquo;m sure everyone appreciates what you&rsquo;re doing as much as I do.</p>\r\n<p>&nbsp;</p>\r\n<p>That makes sense now that you would have to do it such a long way to push it to the background and so on.. But what if you don&rsquo;t have a cancel event is there a simple example you could show me for something like that? Because the program I&rsquo;m making is a patcher it downloads the zip files then extracts them to the right place for them to be all on load of the form there will actually be no buttons for the user to click until after the patch process is done..</p>\r\n<p>&nbsp;</p>\r\n<p>If you do not wish to help anymore on this topic I understand you did help me and I have something that works even though it&rsquo;s a bit over complicated for what I need it works. So I&rsquo;m happy with that. I&rsquo;m just trying to understand all the workings of a dll I&rsquo;m trying to use because this is one I see myself using a lot.</p>\r\n<p>&nbsp;</p>\r\n<p>Again please accept my apologies for the spelling and what not and for taking up so much of your time on this. And thanks for all the help you have given.</p>",
    "PostedDate": "2009-08-12T10:19:29.603-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222647",
    "ThreadId": "65267",
    "Html": "<p>no offense intended.&nbsp;&nbsp; You don't need to explain anything, write however ya want.</p>\r\n<p>For a really simple unzip app that displays a graphical UI, produce a simple WinForms project.&nbsp; Add a single label (label1) and a single progressbar (progressBar1).&nbsp; Then include the following code.&nbsp; You may have to&nbsp;change the name from MyForm to whatever your form is (in 2 places).&nbsp;&nbsp;&nbsp;&nbsp; Somehow you need to pass in the name of the zip file to extract and the directory to which you want to extract.&nbsp; Probably on the command line as arguments.</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> MyForm_Shown(<span style=\"color:Blue\">ByVal</span> sender <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Object</span>, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> EventArgs) Handles MyForm.Shown\r\n    <span style=\"color:Blue\">Try</span> \r\n        <span style=\"color:Blue\">Using</span> zip <span style=\"color:Blue\">As</span> ZipFile = ZipFile.Read(zipfile)\r\n            <span style=\"color:Blue\">Me</span>.progressBar1.Maximum = zip.Entries.<span style=\"color:Blue\">Count</span>\r\n            <span style=\"color:Blue\">Dim</span> entry <span style=\"color:Blue\">As</span> ZipEntry\r\n            <span style=\"color:Blue\">For</span> <span style=\"color:Blue\">Each</span> entry <span style=\"color:Blue\">In</span> zip\r\n                <span style=\"color:Blue\">Me</span>.label1.Text = entry.FileName\r\n                <span style=\"color:Blue\">MyBase</span>.Update\r\n                entry.Extract(<span style=\"color:#A31515\">extractDirectory</span>, ExtractExistingFileAction.OverwriteSilently)\r\n                <span style=\"color:Blue\">Me</span>.progressBar1.PerformStep\r\n                <span style=\"color:Blue\">MyBase</span>.Update\r\n                <span style=\"color:Green\">' sleep because it's too fast otherwise.</span>\r\n                Thread.Sleep(50)\r\n            <span style=\"color:Blue\">Next</span>\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Using</span>\r\n    <span style=\"color:Blue\">Catch</span> ex1 <span style=\"color:Blue\">As</span> Exception\r\n        <span style=\"color:Blue\">Me</span>.label1.Text = (<span style=\"color:#A31515\">&quot;Exception: &quot;</span> &amp; ex1)\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n    <span style=\"color:Green\">' delay for a second after complete, to allow user to gaze</span>\r\n    <span style=\"color:Blue\">Dim</span> timer1 <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">New</span> Timer(1000)\r\n    timer1.Enabled = <span style=\"color:Blue\">True</span>\r\n    timer1.AutoReset = <span style=\"color:Blue\">False</span>\r\n    <span style=\"color:Blue\">AddHandler</span> timer1.Elapsed, <span style=\"color:Blue\">New</span> ElapsedEventHandler(<span style=\"color:Blue\">AddressOf</span> <span style=\"color:Blue\">Me</span>.OnTimerEvent)\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n<span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> OnTimerEvent(<span style=\"color:Blue\">ByVal</span> source <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Object</span>, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> EventArgs)\r\n    <span style=\"color:Blue\">MyBase</span>.Close\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n </pre>\r\n</div>\r\n<p>And, I wouldn't put your download-and-unzip logic in the Load event. I would put it in the <strong>Shown</strong> event, which happens after the form <strong>Load</strong>. It is after Form load that the form is visible. So if you do work inside Load() sometimes, you don't get to see the update of the UI.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-12T11:26:35.163-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222833",
    "ThreadId": "65267",
    "Html": "<p><span style=\"font-size:12pt\">Sorry took so long to reply i took my kid to the beach today and she keep me out all day.. I must say that code looks lot more like what I was looking for lol thanks a lot.. But I&rsquo;m having problems of coarse this stuff cant just work like its suppose to lol</span></p>\r\n<p><span style=\"font-size:12pt\">&nbsp;</span></p>\r\n<p><span style=\"font-size:12pt\">First off I want to understand I&rsquo;m new to this mybase deal what is that?</span></p>\r\n<p><span style=\"font-size:12pt\">MyBase.Update()</span></p>\r\n<p><span style=\"font-size:12pt\">MyBase.Close</span></p>\r\n<p><span style=\"font-size:12pt\">&nbsp;</span></p>\r\n<p><span style=\"font-size:12pt\">I don&rsquo;t understand what&rsquo;s that doing.. Is it needed?</span></p>\r\n<p><span style=\"font-size:12pt\">Then my errors..</span></p>\r\n<p><span style=\"font-size:10pt;color:blue\">Using</span><span style=\"font-size:10pt\"> zip <span style=\"color:blue\">As</span> ZipFile = ZipFile.Read(zipfile)<br> <br> I don't understand why. It&rsquo;s worked all the other times it&rsquo;s exactly the same line as before but I&rsquo;m getting this error from it<br> 'Read' is not a member of 'String'.<br> <br> next problem is </span></p>\r\n<p><span style=\"font-size:10pt;color:blue\">Me</span><span style=\"font-size:10pt\">.label1.Text = (<span style=\"color:#a31515\">&quot;Exception: &quot;</span> &amp; ex1)<br> <br> it seems that ex1 cannot be converted to a string.. <br> Operator '&amp;' is not defined for types 'String' and 'System.Exception'.<br> <br> If I remove everything except ex1 it says it can&rsquo;t be converted to string<br> <br> next problem I fixed but wanted to note it in case anyone else is following this</span></p>\r\n<p><span style=\"font-size:10pt\">Thread.Sleep(50)<br> <br> gave an error I fixed it by changing to <br> <br> System.Threading.Thread.Sleep(50)<br> <br> next problem well this is the last one but it&rsquo;s a few..<br> <br> Dim timer1 As New Timer(1000)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timer1.Enabled = True<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timer1.AutoReset = False<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AddHandler timer1.Elapsed, New ElapsedEventHandler(AddressOf Me.OnTimerEvent)<br> <br> I get error at the 1000<br> autoreset (I don&rsquo;t even think that&rsquo;s a call from timers at least it&rsquo;s not listed in the options for auto fill<br> and ElapsedEventHandler is underlined<br> <br> Value of type 'Integer' cannot be converted to 'System.ComponentModel.IContainer'.</span></p>\r\n<p><span style=\"font-size:10pt\"><br> 'AutoReset' is not a member of 'System.Windows.Forms.Timer'.</span></p>\r\n<p><span style=\"font-size:10pt\"><br> Type 'ElapsedEventHandler' is not defined.<br> <br> Ok that&rsquo;s is all the errors are listed and what I think if anything.. My biggest thing is I want you to explain that MyBase part.. <br> I&rsquo;m not sure what that is and having a problem finding something on google about it that I can understand at lest lol..<br> I just hate using calls and not knowing what they do this is all a learning experience so I like to learn what I can from it.</span></p>",
    "PostedDate": "2009-08-12T23:53:33.647-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "222994",
    "ThreadId": "65267",
    "Html": "<table border=0 width=800px>\r\n<tbody>\r\n<tr>\r\n<td>\r\n<p>Hello Spidey. spending the day at the beach is better that spending the day making zip files.</p>\r\n<p>MyBase.Update()&nbsp; calls the Update method on the base class, in this case, System.Windows.Forms.Form.&nbsp;&nbsp; I don't know how much you know about Object Oriented design, but VB.NET went very OO.&nbsp; In VB6 you had objects, but VB.NET jumped into OO with both feet.&nbsp;&nbsp; The Update and Close methods are on the base class of the Form.&nbsp;</p>\r\n<p>The first method updates the UI - it's a way to tell the program, I just made a change and I'd like the change (maybe progress bar advance) to be visible NOW.&nbsp; If you don't call Update then what can happen is those updates get queued and displayed &quot;later&quot;.  So the goal of calling Update is to make the UI update smoothly.&nbsp;</p>\r\n<p>Close just closes the form, or window.  I understood that you were building an app that unzipped some things and then just closes when it's done.  That's done by the call to Close.</p>\r\n<hr>\r\n<h3>Errors</h3>\r\n<p>If you get an error like &quot;'Read' is not a member of 'String'.&quot;, on a line that includes a sequence like</p>\r\n<pre>    ZipFile.Read(zipfile)\r\n</pre>\r\n<p>.. I think the problem here is one of naming confusion. I'm not a VB person, no expert in VB, but I think VB may be NOT case sensitive, in other words zipfile is the same as ZipFile, in the program.  Now zipfile is the name used to hold the string, the name of the file, while ZipFile is the name of the class.  So if you rename the string to, say, zipfileName, you should avoid this problem.</p>\r\n<pre>    Me.label1.Text = (&quot;Exception: &quot; &amp; ex1)</pre>\r\n<p>Change this to</p>\r\n<pre>    Me.label1.Text = (&quot;Exception: &quot; &amp; ex1.ToString())</pre>\r\n<p>(The reason you're having these problems is that I converted a C# program to VB.NET, using a conversion program.  Like I said,  I'm not a vb.net expert. With the automatic conversion, you get these kinds of problems)</p>\r\n<p>Rather than go through all these problems, how about I just get my converted code to actually compile before I send it to you?&nbsp; The following code compiles successfully, and works.</p>\r\n<p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Green\">'' qunzip.vb</span>\r\n<span style=\"color:Green\">'' ------------------------------------------------------------------</span>\r\n<span style=\"color:Green\">''</span>\r\n<span style=\"color:Green\">'' A simple app that unzips a file, showing a progress bar. </span>\r\n<span style=\"color:Green\">'' It is both a console app, and a winforms app.  </span>\r\n<span style=\"color:Green\">'' </span>\r\n<span style=\"color:Green\">'' built on host: DINOCH-2</span>\r\n<span style=\"color:Green\">'' Created Thu Aug 06 15:34:17 2009</span>\r\n<span style=\"color:Green\">''</span>\r\n<span style=\"color:Green\">'' last saved: </span>\r\n<span style=\"color:Green\">'' Time-stamp: &lt;2009-August-13 11:25:08&gt;</span>\r\n<span style=\"color:Green\">'' ------------------------------------------------------------------</span>\r\n<span style=\"color:Green\">''</span>\r\n<span style=\"color:Green\">'' Copyright (c) 2009 by Dino Chiesa</span>\r\n<span style=\"color:Green\">'' All rights reserved!</span>\r\n<span style=\"color:Green\">''</span>\r\n<span style=\"color:Green\">'' Licensed under the Microsoft Public License.</span>\r\n<span style=\"color:Green\">'' see http://www.opensource.org/licenses/ms-pl.html</span>\r\n<span style=\"color:Green\">''</span>\r\n<span style=\"color:Green\">'' ------------------------------------------------------------------</span>\r\n\r\n<span style=\"color:Blue\">Imports</span> System\r\n<span style=\"color:Blue\">Imports</span> System.Reflection\r\n<span style=\"color:Blue\">Imports</span> System.Windows.Forms\r\n<span style=\"color:Blue\">Imports</span> Ionic.Zip\r\n\r\n\r\n<span style=\"color:Green\">'' to allow fast ngen</span>\r\n&lt;assembly: AssemblyTitle(<span style=\"color:#A31515\">&quot;Qunzip.cs&quot;</span>)&gt;\r\n&lt;assembly: AssemblyDescription(<span style=\"color:#A31515\">&quot;quick winforms unzip tool&quot;</span>)&gt;\r\n&lt;assembly: AssemblyConfiguration(<span style=\"color:#A31515\">&quot;&quot;</span>)&gt;\r\n&lt;assembly: AssemblyCompany(<span style=\"color:#A31515\">&quot;Dino Chiesa&quot;</span>)&gt;\r\n&lt;assembly: AssemblyProduct(<span style=\"color:#A31515\">&quot;Tools&quot;</span>)&gt;\r\n&lt;assembly: AssemblyCopyright(<span style=\"color:#A31515\">&quot;Copyright &copy; Dino Chiesa 2009&quot;</span>)&gt;\r\n&lt;assembly: AssemblyTrademark(<span style=\"color:#A31515\">&quot;&quot;</span>)&gt;\r\n&lt;assembly: AssemblyCulture(<span style=\"color:#A31515\">&quot;&quot;</span>)&gt;\r\n&lt;assembly: AssemblyVersion(<span style=\"color:#A31515\">&quot;1.1.1.1&quot;</span>)&gt;\r\n\r\n\r\n<span style=\"color:Blue\">Namespace</span> Ionic.ToolsAndTests.VB\r\n\r\n    <span style=\"color:Green\">'' see example     :</span>\r\n    <span style=\"color:Green\">'' http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/875952fc-cd2c-4e74-9cf2-d38910bde613</span>\r\n\r\n    <span style=\"color:Blue\">Friend</span> <span style=\"color:Blue\">Class</span> QuickUnzip\r\n        <span style=\"color:Green\">' Methods</span>\r\n        &lt;System.Runtime.InteropServices.DllImport(<span style=\"color:#A31515\">&quot;kernel32.dll&quot;</span>)&gt; _\r\n        <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Shared</span> <span style=\"color:Blue\">Function</span> AllocConsole() <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Boolean</span>\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Function</span>\r\n\r\n        &lt;System.Runtime.InteropServices.DllImport(<span style=\"color:#A31515\">&quot;kernel32.dll&quot;</span>)&gt; _\r\n        <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Shared</span> <span style=\"color:Blue\">Function</span> AttachConsole(<span style=\"color:Blue\">ByVal</span> pid <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Integer</span>) <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Boolean</span>\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Function</span>\r\n\r\n        &lt;STAThread&gt; _\r\n        <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Shared</span> <span style=\"color:Blue\">Sub</span> Main(<span style=\"color:Blue\">ByVal</span> args <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>())\r\n            <span style=\"color:Blue\">If</span> <span style=\"color:Blue\">Not</span> QuickUnzip.AttachConsole(-1) <span style=\"color:Blue\">Then</span>\r\n                QuickUnzip.AllocConsole\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n            <span style=\"color:Blue\">If</span> (args.Length &lt;&gt; 1) <span style=\"color:Blue\">Then</span>\r\n                QuickUnzip.Usage(args)\r\n            <span style=\"color:Blue\">Else</span>\r\n                Application.EnableVisualStyles\r\n                Application.SetCompatibleTextRenderingDefault(<span style=\"color:Blue\">False</span>)\r\n                <span style=\"color:Blue\">Dim</span> f <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">New</span> QuickUnzipForm(args(0))\r\n                Application.Run(f)\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Shared</span> <span style=\"color:Blue\">Sub</span> Usage(<span style=\"color:Blue\">ByVal</span> args <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>())\r\n            Console.WriteLine(<span style=\"color:#A31515\">&quot;QuickUnzip.  Usage:  QuickUnzip &lt;zipfile&gt;&quot;</span>)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Class</span>\r\n\r\n\r\n\r\n    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Class</span> QuickUnzipForm\r\n        <span style=\"color:Blue\">Inherits</span> Form\r\n        <span style=\"color:Green\">' Methods</span>\r\n        <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> <span style=\"color:Blue\">New</span>()\r\n            <span style=\"color:Blue\">Me</span>.components = <span style=\"color:Blue\">Nothing</span>\r\n            <span style=\"color:Blue\">Me</span>.InitializeComponent\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> <span style=\"color:Blue\">New</span>(<span style=\"color:Blue\">ByVal</span> zipfile <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>)\r\n            <span style=\"color:Blue\">Me</span>.<span style=\"color:Blue\">New</span>()\r\n            <span style=\"color:Blue\">Me</span>.zipfileName = zipfile\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Protected</span> <span style=\"color:Blue\">Overrides</span> <span style=\"color:Blue\">Sub</span> Dispose(<span style=\"color:Blue\">ByVal</span> disposing <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Boolean</span>)\r\n            <span style=\"color:Blue\">If</span> (disposing <span style=\"color:Blue\">AndAlso</span> (<span style=\"color:Blue\">Not</span> <span style=\"color:Blue\">Me</span>.components <span style=\"color:Blue\">Is</span> <span style=\"color:Blue\">Nothing</span>)) <span style=\"color:Blue\">Then</span>\r\n                <span style=\"color:Blue\">Me</span>.components.Dispose\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">If</span>\r\n            <span style=\"color:Blue\">MyBase</span>.Dispose(disposing)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> FixTitle()\r\n            <span style=\"color:Blue\">Me</span>.Text = <span style=\"color:Blue\">String</span>.Format(<span style=\"color:#A31515\">&quot;Quick Unzip {0}&quot;</span>, <span style=\"color:Blue\">Me</span>.zipfileName)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> InitializeComponent()\r\n            <span style=\"color:Blue\">Me</span>.components = <span style=\"color:Blue\">New</span> System.ComponentModel.Container\r\n            <span style=\"color:Blue\">Me</span>.label1 = <span style=\"color:Blue\">New</span> Label\r\n            <span style=\"color:Blue\">Me</span>.progressBar1 = <span style=\"color:Blue\">New</span> ProgressBar\r\n            <span style=\"color:Blue\">MyBase</span>.SuspendLayout\r\n            <span style=\"color:Blue\">Me</span>.label1.AutoSize = <span style=\"color:Blue\">True</span>\r\n            <span style=\"color:Blue\">Me</span>.label1.Location = <span style=\"color:Blue\">New</span> System.Drawing.Point(12, 12)\r\n            <span style=\"color:Blue\">Me</span>.label1.Name = <span style=\"color:#A31515\">&quot;label1&quot;</span>\r\n            <span style=\"color:Blue\">Me</span>.label1.Size = <span style=\"color:Blue\">New</span> System.Drawing.Size(50, 13)\r\n            <span style=\"color:Blue\">Me</span>.label1.TabIndex = 2\r\n            <span style=\"color:Blue\">Me</span>.label1.Text = <span style=\"color:#A31515\">&quot;Progress&quot;</span>\r\n            <span style=\"color:Blue\">Me</span>.progressBar1.Anchor = (AnchorStyles.Right <span style=\"color:Blue\">Or</span> (AnchorStyles.Left <span style=\"color:Blue\">Or</span> AnchorStyles.Top))\r\n            <span style=\"color:Blue\">Me</span>.progressBar1.Location = <span style=\"color:Blue\">New</span> System.Drawing.Point(15, 50)\r\n            <span style=\"color:Blue\">Me</span>.progressBar1.Name = <span style=\"color:#A31515\">&quot;progressBar1&quot;</span>\r\n            <span style=\"color:Blue\">Me</span>.progressBar1.Size = <span style=\"color:Blue\">New</span> System.Drawing.Size(310, &amp;H12)\r\n            <span style=\"color:Blue\">Me</span>.progressBar1.<span style=\"color:Blue\">Step</span> = 1\r\n            <span style=\"color:Blue\">Me</span>.progressBar1.TabIndex = 7\r\n            <span style=\"color:Blue\">MyBase</span>.AutoScaleDimensions = <span style=\"color:Blue\">New</span> System.Drawing.SizeF(6!, 13!)\r\n            <span style=\"color:Blue\">MyBase</span>.AutoScaleMode = AutoScaleMode.Font\r\n            <span style=\"color:Blue\">MyBase</span>.ClientSize = <span style=\"color:Blue\">New</span> System.Drawing.Size(340, 140)\r\n            <span style=\"color:Blue\">MyBase</span>.Controls.Add(<span style=\"color:Blue\">Me</span>.label1)\r\n            <span style=\"color:Blue\">MyBase</span>.Controls.Add(<span style=\"color:Blue\">Me</span>.progressBar1)\r\n            <span style=\"color:Blue\">MyBase</span>.Name = <span style=\"color:#A31515\">&quot;QuickUnzipForm&quot;</span>\r\n            <span style=\"color:Blue\">Me</span>.Text = <span style=\"color:#A31515\">&quot;QuickUnzip&quot;</span>\r\n            <span style=\"color:Blue\">AddHandler</span> <span style=\"color:Blue\">MyBase</span>.Load, <span style=\"color:Blue\">New</span> EventHandler(<span style=\"color:Blue\">AddressOf</span> <span style=\"color:Blue\">Me</span>.QuickUnzipForm_Load)\r\n            <span style=\"color:Blue\">AddHandler</span> <span style=\"color:Blue\">MyBase</span>.Shown, <span style=\"color:Blue\">New</span> EventHandler(<span style=\"color:Blue\">AddressOf</span> <span style=\"color:Blue\">Me</span>.QuickUnzipForm_Shown)\r\n            <span style=\"color:Blue\">MyBase</span>.ResumeLayout(<span style=\"color:Blue\">False</span>)\r\n            <span style=\"color:Blue\">MyBase</span>.PerformLayout\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> OnTimerEvent(<span style=\"color:Blue\">ByVal</span> source <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Object</span>, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> EventArgs)\r\n            <span style=\"color:Blue\">MyBase</span>.Close\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> QuickUnzipForm_Load(<span style=\"color:Blue\">ByVal</span> sender <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Object</span>, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> EventArgs)\r\n            <span style=\"color:Blue\">Me</span>.FixTitle\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n        <span style=\"color:Blue\">Private</span> <span style=\"color:Blue\">Sub</span> QuickUnzipForm_Shown(<span style=\"color:Blue\">ByVal</span> sender <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">Object</span>, <span style=\"color:Blue\">ByVal</span> e <span style=\"color:Blue\">As</span> EventArgs)\r\n            <span style=\"color:Blue\">Try</span> \r\n                <span style=\"color:Blue\">Using</span> zip <span style=\"color:Blue\">As</span> ZipFile = ZipFile.Read(<span style=\"color:Blue\">Me</span>.zipfileName)\r\n                    <span style=\"color:Blue\">Me</span>.progressBar1.Maximum = zip.Entries.<span style=\"color:Blue\">Count</span>\r\n                    <span style=\"color:Blue\">Dim</span> entry <span style=\"color:Blue\">As</span> ZipEntry\r\n                    <span style=\"color:Blue\">For</span> <span style=\"color:Blue\">Each</span> entry <span style=\"color:Blue\">In</span> zip\r\n                        <span style=\"color:Blue\">Me</span>.label1.Text = entry.FileName\r\n                        <span style=\"color:Blue\">MyBase</span>.Update\r\n                        entry.Extract(<span style=\"color:#A31515\">&quot;quickunzip&quot;</span>, ExtractExistingFileAction.OverwriteSilently)\r\n                        <span style=\"color:Blue\">Me</span>.progressBar1.PerformStep\r\n                        <span style=\"color:Blue\">MyBase</span>.Update\r\n                        System.Threading.Thread.Sleep(50)\r\n                    <span style=\"color:Blue\">Next</span>\r\n                <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Using</span>\r\n            <span style=\"color:Blue\">Catch</span> ex1 <span style=\"color:Blue\">As</span> Exception\r\n                <span style=\"color:Blue\">Me</span>.label1.Text = (<span style=\"color:#A31515\">&quot;Exception: &quot;</span> &amp; ex1.ToString)\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n            <span style=\"color:Blue\">Dim</span> timer1 <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">New</span> System.Timers.Timer(1000)\r\n            timer1.Enabled = <span style=\"color:Blue\">True</span>\r\n            timer1.AutoReset = <span style=\"color:Blue\">False</span>\r\n            <span style=\"color:Blue\">AddHandler</span> timer1.Elapsed, <span style=\"color:Blue\">New</span> System.Timers.ElapsedEventHandler(<span style=\"color:Blue\">AddressOf</span> <span style=\"color:Blue\">Me</span>.OnTimerEvent)\r\n        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n\r\n\r\n        <span style=\"color:Green\">' Fields</span>\r\n        <span style=\"color:Blue\">Private</span> zipfileName <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>\r\n        <span style=\"color:Blue\">Private</span> components <span style=\"color:Blue\">As</span> System.ComponentModel.IContainer\r\n        <span style=\"color:Blue\">Private</span> label1 <span style=\"color:Blue\">As</span> Label\r\n        <span style=\"color:Blue\">Private</span> progressBar1 <span style=\"color:Blue\">As</span> ProgressBar\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Class</span>\r\n\r\n\r\n\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Namespace</span>\r\n\r\n</pre>\r\n</div>\r\n</p>\r\n<p>I suggest you get yourself a book, like a VB.NET for VB developers book.&nbsp; You might be able to find some help on http://msdn.microsoft.com/en-us/vbasic/default.aspx.&nbsp; Check out the &quot;Getting Started&quot; link on the left-hand-side.</p>\r\n<p>Good luck!</p>\r\n<p>&nbsp;</p>\r\n</td>\r\n</tr>\r\n</tbody>\r\n</table>",
    "PostedDate": "2009-08-13T08:28:18.073-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223018",
    "ThreadId": "65267",
    "Html": "<p>thanks alot thats what i needed.</p>\r\n<p>this is what i got working for everyone or anyone that is following this topic.</p>\r\n<p>i made a new module my main form is named form1 (you need to change this to whatever your form name is in the module wherever it says form1 i underlined bold and turned red all the spots)</p>\r\n<p>name the module SimpleUnzip.vb</p>\r\n<p>past this code in the module</p>\r\n<p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">Imports</span> Ionic.Zip<br><br><span style=\"color:Blue\">Module</span> SimpleUnzip<br>    <span style=\"color:Blue\">Public</span> <span style=\"color:Blue\">Sub</span> Unzip(<span style=\"color:Blue\">ByVal</span> ZipToUnpack <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>, <span style=\"color:Blue\">ByVal</span> DirectoryToExstractTo <span style=\"color:Blue\">As</span> <span style=\"color:Blue\">String</span>)<br>        <span style=\"color:Blue\">Try</span>\r\n            <span style=\"color:Blue\">Using</span> zip <span style=\"color:Blue\">As</span> ZipFile = ZipFile.Read(ZipToUnpack)<br>                <strong><span style=\"text-decoration:underline\"><span style=\"color:#800000\">Form1</span></span></strong>.ProgressBar1.Maximum = zip.Entries.<span style=\"color:Blue\">Count</span>\r\n                <span style=\"color:Blue\">Dim</span> entry <span style=\"color:Blue\">As</span> ZipEntry<br>                <span style=\"color:Blue\">For</span> <span style=\"color:Blue\">Each</span> entry <span style=\"color:Blue\">In</span> zip<br>                    <strong><span style=\"text-decoration:underline\"><span style=\"color:#800000\">Form1</span></span></strong>.Label1.Text = entry.FileName<br>                    entry.Extract(DirectoryToExstractTo, ExtractExistingFileAction.OverwriteSilently)<br>                    <span style=\"color:#800000\"><span style=\"text-decoration:underline\"><strong>Form1</strong></span></span>.ProgressBar1.Value = <span style=\"color:#800000\"><span style=\"text-decoration:underline\"><strong>Form1</strong></span></span>.ProgressBar1.Value + 1<br>                    <span style=\"color:Green\">' sleep because it's too fast otherwise.</span>\r\n                    System.Threading.Thread.Sleep(50)\r\n                <span style=\"color:Blue\">Next</span><br>               <span style=\"color:#800000\"> <strong><span style=\"text-decoration:underline\">Form1</span></strong></span>.ProgressBar1.Value = 0<br>                <span style=\"color:#800000\"><span style=\"text-decoration:underline\"><strong>Form1</strong></span></span>.Label1.Text = <span style=\"color:#A31515\">&quot;Done&quot;</span>\r\n            <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Using</span>\r\n        <span style=\"color:Blue\">Catch</span> ex1 <span style=\"color:Blue\">As</span> Exception<br>            <span style=\"color:#800000\"><span style=\"text-decoration:underline\"><strong>Form1</strong></span></span>.Label1.Text = (<span style=\"color:#A31515\">&quot;Exception: &quot;</span> &amp; ex1.ToString())<br>        <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Try</span>\r\n    <span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Sub</span>\r\n<span style=\"color:Blue\">End</span> <span style=\"color:Blue\">Module</span>\r\n</pre>\r\n</div>\r\n</p>\r\n<p>that's it.. call it in your forum with</p>\r\n<p>Unzip(&quot;C1P3SML.zip&quot;, &quot;C1P3SML&quot;)</p>\r\n<p>or</p>\r\n<p>Unzip(unzip file, dir to unzip to)</p>\r\n<p>&nbsp;</p>\r\n<p>that's it so simple i cant beleave i needed so much help lol.. thanks alot Cheeso your the man.</p>",
    "PostedDate": "2009-08-13T09:42:51.45-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "223114",
    "ThreadId": "65267",
    "Html": "<p>Glad it worked for you.</p>\r\n<p>here is the full example (with multi-threading):</p>\r\n<p><a href=\"http://dotnetzip.codeplex.com/Wiki/View.aspx?title=WinForms-QuickUnzip-VB\">http://dotnetzip.codeplex.com/Wiki/View.aspx?title=WinForms-QuickUnzip-VB</a></p>",
    "PostedDate": "2009-08-13T14:01:35.587-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]