Results 1 to 8 of 8

Thread: OpenFileDialog and extract from a zip file

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    OpenFileDialog and extract from a zip file

    If I am in Word and I say File Open, it displays files of type All Files. If I have a Compressed Folder in the current location, I can right click on that folder and Extract All. Then if I extracted a filetype that Word can read, I can click on the file I just extracted and opened this is Word. All from saying File Open. I want to replicate this behavior in my .NET code.

    Maybe I am missing a property when I create my OpenFileDialog, but if I right click on the same file as above, I do not get a context menu that will let me Extract All. Why not? I get nothing. This is my .NET code:
    Code:
                Dim dlgZipFile As New OpenFileDialog
                dlgZipFile.Title = "Please navigate to the location of the input file"
                dlgZipFile.InitialDirectory = "C:\Projects\Files"
                dlgZipFile.Filter = "All Files (*.*)|*.*"
                dlgZipFile.FileName = ""
                If dlgZipFile.ShowDialog <> Windows.Forms.DialogResult.OK Then Return False
    Is there something else I need which perhaps Word is providing which is making happen what is not happening in my code?
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: OpenFileDialog and extract from a zip file

    In fact, I get a context menu for every single file in the folder *except* the compressed ones, which are the ones I want!
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: OpenFileDialog and extract from a zip file

    All I can tell you is that, if I open an OpenFileDialog and right-click on a ZIP file, I get an option to Extract All.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: OpenFileDialog and extract from a zip file

    From code *you* wrote? And it's like mine, or has additional properties you set?
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: OpenFileDialog and extract from a zip file

    All I did was create an OpenFileDialog and call ShowDialog.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: OpenFileDialog and extract from a zip file

    This is the explanation I got from a co-worker after discussing it with him. We believe that Word can do it because it is using its own OpenFileDialog, not the same one we have available developing .NET apps. In a web browser, if we do file, open, browse, neither of us gets a context menu there. But in Word we do. He believes it is our company blocking it. But I have no idea how...
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: OpenFileDialog and extract from a zip file

    That's possible I guess. Your administrator does have access to many configuration options via Active Directory, so that might be something they did. Not sure why they would mind you, but the .NET OpenFielDialogue is just a wrapper for the Windows common dialogue so it will pick up Windows changes.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    My Mustang GT
    Posts
    4,566

    Re: OpenFileDialog and extract from a zip file

    Well the more I thought about it yesterday the more I wasn't sure what the web browser had to do with it, as this is a Windows application, so I'm not sure exactly what point he was trying to make. Just that he has some capability on his own PC that's not on his company-owned PC. But if I get a context menu in Windows Explorer I don't know why I wouldn't get the same in my WinForms .NET application. If it's allowed in the former, why would it be blocked in the latter?

    Anyway, if I can't get this to work I will have to incorporate code to unzip the files in my application, which is okay, but a lot more work than just having an Extract All option available at everyone's fingertips. Plus I can't just use any zipware code that I download as I'm not allowed to download anything. But I think we have our own applications where someone may have written or interfaced with an approved zip software product.

    The last thing I want to do is write an application like John's (create an OpenFileDialog then Show it), compile it at work and see what I get and compile it at home and see what I get. My guess it will present the context menu at home but not at work.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width