Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9236623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:20:15+00:00 2026-06-18T07:20:15+00:00

I have form with text box and customer wants to store all changes from

  • 0

I have form with text box and customer wants to store all changes from this textbox to zip archive.

I am using http://dotnetzip.codeplex.com
and i have example of code:

 using (ZipFile zip = new ZipFile())
  {
    zip.AddFile("text.txt");    
    zip.Save("Backup.zip");
  }

And i dont want to create each time temp text.txt and zip it back.
Can I access text.txt as Stream inside zip file and save text there?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:20:17+00:00Added an answer on June 18, 2026 at 7:20 am

    There is an example in DotNetZip that use a Stream with the method AddEntry.

    String zipToCreate = "Content.zip";
    String fileNameInArchive = "Content-From-Stream.bin";
    using (System.IO.Stream streamToRead = MyStreamOpener())
    {
      using (ZipFile zip = new ZipFile())
      {
        ZipEntry entry= zip.AddEntry(fileNameInArchive, streamToRead);
        zip.Save(zipToCreate);  // the stream is read implicitly here
      }
    }
    

    A little test using LinqPad shows that it is possible to use a MemoryStream to build the zip file

    void Main()
    {
        UnicodeEncoding uniEncoding = new UnicodeEncoding();
        byte[] firstString = uniEncoding.GetBytes("This is the current contents of your TextBox");
        using(MemoryStream memStream = new MemoryStream(100))
        {
            memStream.Write(firstString, 0 , firstString.Length);
            // Reposition the stream at the beginning (otherwise an empty file will be created in the zip archive
            memStream.Seek(0, SeekOrigin.Begin);
            using (ZipFile zip = new ZipFile())
            {
                ZipEntry entry= zip.AddEntry("TextBoxData.txt", memStream);
                zip.Save(@"D:\temp\memzip.zip");  
            }
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a text box that has its value changed from
i have form where i have text box value and link (add). when user
I have a form in which i have a text box for email and
I have a C# form that has a text box that needs to constantly
i have a text box on my form. I want to write 0x31 as
I have a Form with TextBox on it like this: Form f = new
I have a form ,in that there have a text box which can take
I have a simple MS Access form that has 3 objects: a text box,
I have a form with: 1 text box (MyTextBox) 3 check boxes (MyCheckBox1, MyCheckBox2,
I have a form with Name textbox Address textbox Phone textbox Insert buttion and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.