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

  • Home
  • SEARCH
  • 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 8191357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:54:04+00:00 2026-06-07T03:54:04+00:00

Error : ‘string’ does not contain a definition for ‘SelectedPath’ and no extension method

  • 0

Error:
‘string’ does not contain a definition for ‘SelectedPath’ and no extension method ‘SelectedPath’ accepting a first argument of type ‘string’ could be found

Code:

 private static string fbd = String.Empty;
    public void button2_Click(object sender, EventArgs e)
    {
        FolderBrowserDialog fbd = new FolderBrowserDialog();
        fbd.Description = "Select a Folder to save the images.";
        if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            textBox1.Text = fbd.SelectedPath;
    }

public void button3_Click(object sender, EventArgs e)
    {

        List<string> address = new List<string>();
        Random r = new Random();
        address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600000_460s.jpg");
        address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600001_460s.jpg");
        address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600002_460s.jpg");
        address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600003_460s.jpg");
        //MessageBox.Show(address[r.Next(0, 4)]);

        if (comboBox1.Text == "10")
        {
            string filename = fbd.SelectedPath;
            MessageBox.Show(fbd);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(address[r.Next(0, 4)]));
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            if ((response.StatusCode == HttpStatusCode.OK ||
                response.StatusCode == HttpStatusCode.Moved ||
                response.StatusCode == HttpStatusCode.Redirect) &&
                response.ContentType.StartsWith("image", StringComparison.OrdinalIgnoreCase))
            {

                using (Stream inputStream = response.GetResponseStream())
                using (Stream outputStream = File.OpenWrite(filename))
                {
                    byte[] buffer = new byte[4096];
                    int bytesRead;
                    do
                    {
                        bytesRead = inputStream.Read(buffer, 0, buffer.Length);
                        outputStream.Write(buffer, 0, bytesRead);
                    } while (bytesRead != 0);
                    using (WebClient client = new WebClient())
                    {
                        client.DownloadFile(address[r.Next(0, 25)], filename);
                    }

                }
            }
        }


    }

Explanation:
For button3_Click im trying to get it to call the save location you set to save the image. I have looked all over the net and im not finding a way to fix this :/

I also am getting an error when i manually enter a save location.
Access to the path ‘H:\images’ is denied.
And no the folder is not read only. It gives me the same error no matter where i set the save location.

  • 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-07T03:54:05+00:00Added an answer on June 7, 2026 at 3:54 am

    fdb is a string. You have declared a class-wide field called fdb of type string, which doesn’t have the property SelectedPath

    In yout button2_click method, you have a File Dialog that presumably you want to access instead, so you need to declare that in the class-wide scope instead.

    private FolderBrowserDialog _fbDlg;
    private static string fbd = String.Empty; // Do you really need this?
        public void button2_Click(object sender, EventArgs e)
        {
            _fbDlg = new FolderBrowserDialog();
            _fbDlg.Description = "Select a Folder to save the images.";
            if (_fbDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                textBox1.Text = _fbDlg.SelectedPath;
        }
    
    public void button3_Click(object sender, EventArgs e)
        {
    
            List<string> address = new List<string>();
            Random r = new Random();
            address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600000_460s.jpg");
            address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600001_460s.jpg");
            address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600002_460s.jpg");
            address.Add("http://d24w6bsrhbeh9d.cloudfront.net/photo/4600003_460s.jpg");
            //MessageBox.Show(address[r.Next(0, 4)]);
    
            if (comboBox1.Text == "10")
            {
                string filename = _fbDlg.SelectedPath;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Error message: The type 'GoogleMapProject_Behaviors:ZoomBehavior' was not found. Verify that you are not missing
Error in NSLog: *** -[NSThread initWithTarget:selector:object:]: target does not implement selector (*** -[Document myTcpClient])
Error Cannot implicitly convert type 'string[]' to 'System.Collections.Generic.List<string>' The above error is caused when
Error: Could not find control 'mytextfield' in ControlParameter 'mycontrolparam'. <asp:ControlParameter ControlID=mytextfield Name=mycontrolparam PropertyName=Text Type=Int32
Error: undefined method `author' for nil:NilClass In my helper: def last_updated(group) g = group.last_updated_version
error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : >could not deduce template argument
error CS0266: Cannot implicitly convert type 'object' to 'int'. An explicit conversion exists (are
Error: TypeError at /confirmemail/amlqctnhel/ confirmemail() takes exactly 2 arguments (1 given) Request Method: GET
Error 7 The type 'System.Web.Routing.RouteValueDictionary' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.dll' and 'c:\WINNT\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll' c:\Projects\VS\solutionfolder\projectfolder\Views\group\List.aspx
ERROR: Microsoft JScript runtime error: Object doesn't support this property or method here is

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.