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 9204789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:47:38+00:00 2026-06-17T23:47:38+00:00

Since I put my OpenFileDialog into a BackgroundWorker, the Filter option no longer works.

  • 0

Since I put my OpenFileDialog into a BackgroundWorker, the Filter option no longer works.

I use to have this as a button click and it worked fine, with the exception of what every file I opened it wouldn’t close the file, hence I added the BackgroundWorker.

Anywho, here’s my current code, nothing different from the button click code I had.

Dim OpenFileDialog2 As New OpenFileDialog()

OpenFileDialog2.InitialDirectory = "C:\Temp\Config_Files\"
OpenFileDialog2.Filter = "Configuration Files (*.cfg)|*.cfg"

Is there something I need to add to make this work properly?

  • 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-17T23:47:40+00:00Added an answer on June 17, 2026 at 11:47 pm

    I think that you are misunderstanding the advice to use a backgroundworker.
    You should let the OpenFileDialog do its work and grab the cfg file to be processed, then, if you want a faster UI response start the backgroundworker.

    Dim fileToProcess as String = string.Empty
    Using opf As New OpenFileDialog()
        opf.InitialDirectory = "C:\Temp\Config_Files\"
        opf.Filter = "Configuration Files (*.cfg)|*.cfg"
        if opf.ShowDialog() = DialogResult.OK then
            fileToProcess = opf.FileName
        Endif
    End Using
    if fileToProcess <> string.Empty then
        ' Now start you backgroundworker to do its job
    end if
    

    Of course, the user could re-start againg the same code and select again the same file. This could lead to unexpected results. Better to disable the Button/Menu or whatever that start the file selection process till the previous process ends.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I believe I don't have to put my code here since this is not
Since I cannot put conditions on elements in a component, I have to separate
Since the GOF book was put together well before .Net came into being, are
The application has been put in iCloud since the beginning, so I have the
Last night I tried to put together something that I have had working since
(I've put ...to Entities in brackets since I don't know if this matters at
I don't know what to put in search bar since I have no idea
I created a database with data that I put into a ListView . Since
Since this is answered I put the simplest answer here. (Thanks to Bergi) first
I know this may be stupid question i am gonna put here since i

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.