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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:46:32+00:00 2026-06-08T00:46:32+00:00

In the first start of my application I need to specify a path to

  • 0

In the first start of my application I need to specify a path to save some files to it. But in the open file dialogue it seems like that I have to select a file to open. How can I just specify a folder without oppening a file
like C:\config\

Here is my code

If apppath = "" Then
        Dim fd As OpenFileDialog = New OpenFileDialog()
        fd.Title = "Select Application Configeration Files Path"
        fd.InitialDirectory = "C:\"
        fd.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
        fd.FilterIndex = 2
        fd.RestoreDirectory = True
        If fd.ShowDialog() = DialogResult.OK Then
            apppath = fd.FileName
        End If
        My.Computer.FileSystem.WriteAllText(apppath & "apppath.txt", apppath, False)
    End If

I need to select a file in order for it to work, but I just want to select a folder. So what’s the solution?

  • 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-08T00:46:34+00:00Added an answer on June 8, 2026 at 12:46 am

    You want to use the FolderBrowserDialog class instead of the OpenFileDialog class. You can find more information about it here:

    http://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog(v=vs.110).aspx

    For instance, you could do this:

    If apppath = "" Then
        Dim dialog As New FolderBrowserDialog()
        dialog.RootFolder = Environment.SpecialFolder.Desktop
        dialog.SelectedPath = "C:\"
        dialog.Description = "Select Application Configeration Files Path"
        If dialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
            apppath = dialog.SelectedPath
        End If
        My.Computer.FileSystem.WriteAllText(apppath & "apppath.txt", apppath, False)
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application should load some data when it start at first time, but it
I would like to start a System.Threading.Timer in my application when it launches (maybe
I've inherited an ASP.NET application that contains a login screen. When you first start
I need to develop this kind of application, i'm using php and mysql first
I need to display the virtual keyboard when the application starts, but so far
IN my application I need to call intent of Gtalk. therefore at first i
I have an application that when it first starts i need it to run
Something equivalent to this command line: set PATH=%PATH%;C:\Something\bin To run my application, some thing
I can start my application by simply putting the phone on a NFC-tag. But
In my Windows Phone Applicarion I need to implement logic to start some Method

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.